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

Method main

tests/python/relax/test_frontend_from_exported_program.py:1361–1380  ·  view source on GitHub ↗
(input: R.Tensor((10, 10), dtype="float32"))

Source from the content-addressed store, hash-verified

1359 class expected_triu:
1360 @R.function
1361 def main(input: R.Tensor((10, 10), dtype="float32")) -> R.Tuple(
1362 R.Tensor((10, 10), dtype="float32")
1363 ):
1364 # block 0
1365 with R.dataflow():
1366 lv: R.Tensor((10,), dtype="int64") = R.arange(
1367 R.prim_value(0), R.prim_value(10), R.prim_value(1), dtype="int64"
1368 )
1369 lv1: R.Tensor((1, 10), dtype="int64") = R.expand_dims(lv, axis=[-2])
1370 lv2: R.Tensor((10,), dtype="int64") = R.arange(
1371 R.prim_value(0), R.prim_value(10), R.prim_value(1), dtype="int64"
1372 )
1373 lv3: R.Tensor((10, 1), dtype="int64") = R.expand_dims(lv2, axis=[-1])
1374 lv4: R.Tensor((10, 10), dtype="int64") = R.subtract(lv1, lv3)
1375 lv5: R.Tensor((10, 10), dtype="bool") = R.greater_equal(lv4, R.const(1, "int64"))
1376 lv6: R.Tensor((), dtype="float32") = R.const(0.0, "float32")
1377 lv7: R.Tensor((10, 10), dtype="float32") = R.where(lv5, input, lv6)
1378 gv: R.Tuple(R.Tensor((10, 10), dtype="float32")) = (lv7,)
1379 R.output(gv)
1380 return gv
1381
1382 verify_model(Triu(), example_args, {}, expected_triu)
1383

Callers

nothing calls this directly

Calls 8

TensorMethod · 0.80
dataflowMethod · 0.80
subtractMethod · 0.80
greater_equalMethod · 0.80
whereMethod · 0.80
outputMethod · 0.80
arangeMethod · 0.45
expand_dimsMethod · 0.45

Tested by

no test coverage detected