Skip to content

test: add softshrink operator coverage#766

Open
voltjia wants to merge 1 commit into
masterfrom
test/softshrink-operator-coverage
Open

test: add softshrink operator coverage#766
voltjia wants to merge 1 commit into
masterfrom
test/softshrink-operator-coverage

Conversation

@voltjia

@voltjia voltjia commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add focused softshrink operator coverage in tests/test_softshrink.py.
  • Cover contiguous and strided 2D/3D layouts for float32, float16, and bfloat16.

Motivation

The generated smoke coverage exercises broad PyTorch backend wiring, but each operator still needs direct tests similar to the existing handwritten operator tests. This PR adds one more elementwise operator test while keeping review scope small.

Closes N/A

Type of Change

  • feat — new feature / new operator / new platform
  • fix — bug fix
  • perf — performance improvement (no behavioral change)
  • refactor — code restructuring without behavior change
  • test — adding or fixing tests only
  • docs — documentation only
  • build / ci — build system or CI configuration
  • chore — tooling, formatting, or other non-code changes
  • Breaking change (requires a ! in the Conventional Commits prefix or a BREAKING CHANGE: footer)

Platforms Affected

  • CPU (WITH_CPU)
  • NVIDIA (WITH_NVIDIA)
  • Iluvatar (WITH_ILUVATAR)
  • MetaX (WITH_METAX)
  • Cambricon (WITH_CAMBRICON)
  • Moore (WITH_MOORE)
  • Ascend (WITH_ASCEND)
  • PyTorch C++ bindings (WITH_TORCH)
  • Build system / CMake / CI
  • Python bindings / user-facing API

Smoke Test Result

Validated as part of a focused activation/elementwise batch including tests/test_softshrink.py:

python3 -m pytest tests/test_hardshrink.py tests/test_hardtanh.py tests/test_leaky_relu.py tests/test_softplus.py tests/test_softshrink.py tests/test_threshold.py -q -v --devices cpu <platform> --tb=short

Quality checks:

python3 -m ruff format --check tests/test_gelu.py tests/test_hardshrink.py tests/test_hardtanh.py tests/test_leaky_relu.py tests/test_softplus.py tests/test_softshrink.py tests/test_threshold.py
7 files already formatted

python3 -m ruff check tests/test_gelu.py tests/test_hardshrink.py tests/test_hardtanh.py tests/test_leaky_relu.py tests/test_softplus.py tests/test_softshrink.py tests/test_threshold.py
All checks passed!

Test Results on Supported Platforms

Build timing includes the required InfiniRT setup/build plus the InfiniOps focused smoke build.

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA Yes Elementwise batch: 252 passed; build 152s, test 6s, total 158s Includes tests/test_softshrink.py
Iluvatar Yes Elementwise batch: 252 passed; build 137s, test 4s, total 141s Includes tests/test_softshrink.py
MetaX Yes Elementwise batch: 252 passed; build 223s, test 15s, total 238s Includes tests/test_softshrink.py
Cambricon Yes Elementwise batch: 252 passed; build 314s, test 10s, total 324s Includes tests/test_softshrink.py
Moore Yes Elementwise batch: 252 passed; build 302s, test 21s, total 323s Includes tests/test_softshrink.py
Ascend Yes Elementwise batch: 216 passed; build 182s, test 15s, total 197s Includes tests/test_softshrink.py; pytest summary passed, container returned 137 after summary
Full `pytest` output (optional)
NVIDIA:    collected 252 items; 252 passed in 1.25s
Iluvatar:  collected 252 items; 252 passed in 1.06s
MetaX:     collected 252 items; 252 passed in 0.97s
Cambricon: collected 252 items; 252 passed in 4.51s
Moore:     collected 252 items; 252 passed in 14.68s
Ascend:    collected 216 items; 216 passed in 2.54s

Benchmark / Performance Impact

N/A - test-only PR.

Notes for Reviewers

This PR intentionally adds only one operator test. The branch was validated through a shared elementwise batch to avoid repeating the same six-platform build for each single-file PR.

A local gelu candidate was included in the five-platform superset run but is not part of this PR batch. It was held back because Ascend reported an independent strided NPU gelu runtime error.

@voltjia voltjia requested a review from a team June 26, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant