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
{{ message }}
Repository navigation
[Bug][Relax] x * t.item() fails in from_exported_program when x is float and t is an integer tensor #20939
t.item() on an integer tensor gives a Python int, and x * t.item() with a float x gives a float tensor. It works in eager and torch.export, so from_exported_program should convert it.
Actual behavior
The conversion fails. The same happens for +, -, /, for t.item() * x and for a float16 x. A float t, or an integer x, works.
eager: [4.5, 6.0] torch.float32
TypeError: Binary operators must have the same datatype for both operands. However, ... "relax.multiply" ... uses datatype T.float32 on the LHS (Type of R.Tensor((2,), dtype="float32")), and datatype T.int64 on the RHS (Type of T.int64).
Possibly _item turns an integer tensor into an int64 symbolic variable, and _binary_op passes it on without casting it to the dtype of the float tensor.
Environment
TVM: main @ 2bf0532 (0.28.dev0), built from source, target llvm
Activity