-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[Bug] Wrong results of cast<int32>( cast<bool>(-1i64) ) #13048
Copy link
Copy link
Closed
Labels
needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address itPRs or issues that need to be investigated by maintainers to find the right assignees to address ittype: bug
Description
Expected behavior
cast<int32>( cast<bool>(-1i64) ) should be 1.
Actual behavior
cast<int32>( cast<bool>(-1i64) ) returns wrong results (i.e., -1) in optimized graph runtime.
Environment
fa17da2 on Ubuntu 20.04.
Steps to reproduce
Preferably a minimal script to cause the issue to occur.
import tvm
from tvm import relay
import numpy as np
i0 = relay.var("i0", shape=(1,), dtype="int64")
cast_bool = relay.cast(i0, "bool")
cast_int32 = relay.cast(cast_bool, "int32")
f = relay.Function([i0], cast_int32)
input = np.array([-1], dtype="int64")
opt_res = relay.create_executor("graph", device=tvm.cpu()).evaluate(f)(input)
debug_res = relay.create_executor("debug", device=tvm.cpu()).evaluate(f)(input)
print(f"debug_res: \t{debug_res}") # [-1]
print(f"opt_res: \t{opt_res}") # [1]Triage
Please refer to the list of label tags linked above to find the relevant tags and add them here in a bullet format (example below).
- needs-triage
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address itPRs or issues that need to be investigated by maintainers to find the right assignees to address ittype: bug