Skip to content

feat!: align normal with PyTorch API - #855

Closed
voltjia wants to merge 1 commit into
feat/dispatch-from-any-tensorfrom
feat/align-normal-python-api
Closed

feat!: align normal with PyTorch API#855
voltjia wants to merge 1 commit into
feat/dispatch-from-any-tensorfrom
feat/align-normal-python-api

Conversation

@voltjia

@voltjia voltjia commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Expose the four PyTorch normal overload families with optional Generator.
  • Add the missing scalar-mean and scalar/scalar-with-size forms.
  • Keep the two previous Tensor-mean signatures as explicitly deprecated compatibility overloads.

Motivation

InfiniOps covered only Tensor mean with Tensor/scalar std and omitted generator. The public API therefore could not represent half of PyTorch's standard overload set.

Depends on #851 and #839.

API Alignment

InfiniOps API PyTorch alignment Reference
normal(mean: Tensor, std: double, generator, out) Tensor mean, scalar std overload PyTorch source
normal(mean: Tensor, std: Tensor, generator, out) Tensor mean, Tensor std overload PyTorch source
normal(mean: double, std: Tensor, generator, out) Scalar mean, Tensor std overload PyTorch source
normal(mean: double, std: double, size, generator, out) Scalar mean/std with explicit size overload PyTorch source

The explicit C++ output remains trailing in every overload.

Type of Change

  • feat
  • fix
  • perf
  • refactor
  • test
  • docs
  • build / ci
  • chore
  • Breaking change

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

accelerator-dev/nvidia:latest, CPU + NVIDIA + Torch targeted build
Targeted integration suite: 241 passed, 8 warnings in 4.22s

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA Yes targeted wheel build passed all four overload families passed on CPU and CUDA
Iluvatar No N/A N/A
MetaX No N/A N/A
Cambricon No N/A N/A
Moore No N/A N/A
Ascend No N/A N/A

Benchmark / Performance Impact

N/A.

Notes for Reviewers

These are exactly the four PyTorch overload families identified in the audit. The former two signatures remain available with [[deprecated]].

@voltjia

voltjia commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator Author

Deferred from the current interface-alignment batch. This change combines Tensor/scalar normal overloads with Generator support; both categories are intentionally postponed for a focused follow-up.

@voltjia voltjia closed this Jul 29, 2026
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