Skip to content

test: add nan_to_num operator coverage#769

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

test: add nan_to_num operator coverage#769
voltjia wants to merge 1 commit into
masterfrom
test/nan-to-num-operator-coverage

Conversation

@voltjia

@voltjia voltjia commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds handwritten nan_to_num operator coverage in tests/test_nan_to_num.py.
  • Covers contiguous and strided inputs/outputs across float32, float16, and bfloat16, including NaN, positive infinity, and negative infinity replacement.

Motivation

Generated smoke coverage confirms the PyTorch backend path is wired, but it does not provide focused per-operator correctness coverage. This PR adds a dedicated nan_to_num test following the existing operator-test style.

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

ruff format --check tests/test_clip.py tests/test_nan_to_num.py
2 files already formatted

ruff check tests/test_clip.py tests/test_nan_to_num.py
All checks passed!

Cross-platform cropped smoke validation:
python3 -m pytest tests/test_clip.py tests/test_nan_to_num.py -q -v --devices <cpu + platform>
72 passed

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA Yes passed; build 149s, test 5s, total 154s 72 passed
Iluvatar Yes passed; build 138s, test 4s, total 142s 72 passed
MetaX Yes passed; build 224s, test 15s, total 239s 72 passed
Cambricon Yes passed; build 312s, test 8s, total 320s 72 passed
Moore Yes passed; build 305s, test 20s, total 325s 72 passed
Ascend Yes pytest passed; build 186s, test 14s, total 200s 72 passed; container exit code was 137 after pytest summary, consistent with prior Ascend runs
Full `pytest` output (optional)
NVIDIA:    tests/test_clip.py + tests/test_nan_to_num.py: 72 passed in 0.90s
Iluvatar:  tests/test_clip.py + tests/test_nan_to_num.py: 72 passed in 0.52s
MetaX:     tests/test_clip.py + tests/test_nan_to_num.py: 72 passed in 0.42s
Cambricon: tests/test_clip.py + tests/test_nan_to_num.py: 72 passed in 2.63s
Moore:     tests/test_clip.py + tests/test_nan_to_num.py: 72 passed in 13.42s
Ascend:    tests/test_clip.py + tests/test_nan_to_num.py: 72 passed in 1.72s

Benchmark / Performance Impact

N/A - test-only change.

Notes for Reviewers

This PR is split from a batch of elementwise operator tests. logit, clamp_max, clamp_min, gelu, and conj_physical are intentionally left out because they need separate backend or generated-wrapper follow-up before they can be made non-regressing across all platforms.

@voltjia voltjia requested a review from a team June 26, 2026 09:01
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