You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace op.Constant(value_float=...) with Python float literals, use autocast (#166)
Continuation of PR #58 which established this pattern.
Replace all 68 instances of op.Constant(value_float=X) across 30 files
with plain Python float literals or float() expressions. This leverages
onnxscript's auto-casting of Python scalars to match the dtype of the
other operand in binary ops, which fixes dtype mismatches when models
use bfloat16 or float16.
Patterns replaced:
- op.Constant(value_float=X) -> X (plain literal)
- op.Constant(value_float=float(expr)) -> float(expr)
- op.Constant(value_float=self.attr) -> self.attr
- op.CastLike(op.Constant(value_float=X), ref) -> op.CastLike(X, ref)
Note: This is part 1. (A similar change can be done for int/ints/floats,
but will do that in separate PRs.)
---------
Signed-off-by: G Ramalingam <grama@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments