MCPcopy Create free account
hub / github.com/apache/tvm / test_logical_xor

Function test_logical_xor

tests/python/relax/test_frontend_from_exported_program.py:1098–1123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1096
1097
1098def test_logical_xor():
1099 class LogicalXor(Module):
1100 def forward(self, lhs, rhs):
1101 return torch.logical_xor(lhs, rhs)
1102
1103 @tvm.script.ir_module
1104 class expected:
1105 @R.function
1106 def main(
1107 lhs: R.Tensor((1, 3, 10, 10), dtype="float32"),
1108 rhs: R.Tensor((1, 3, 10, 10), dtype="float32"),
1109 ) -> R.Tuple(R.Tensor((1, 3, 10, 10), dtype="bool")):
1110 # block 0
1111 with R.dataflow():
1112 lv: R.Tensor((1, 3, 10, 10), dtype="bool") = R.astype(lhs, dtype="bool")
1113 lv1: R.Tensor((1, 3, 10, 10), dtype="bool") = R.astype(rhs, dtype="bool")
1114 lv2: R.Tensor((1, 3, 10, 10), dtype="bool") = R.logical_xor(lv, lv1)
1115 gv: R.Tuple(R.Tensor((1, 3, 10, 10), dtype="bool")) = (lv2,)
1116 R.output(gv)
1117 return gv
1118
1119 example_args = (
1120 torch.randn(1, 3, 10, 10, dtype=torch.float32),
1121 torch.randn(1, 3, 10, 10, dtype=torch.float32),
1122 )
1123 verify_model(LogicalXor(), example_args, {}, expected)
1124
1125
1126def test_pow_integer():

Callers

nothing calls this directly

Calls 2

verify_modelFunction · 0.70
LogicalXorClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…