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

Function test_sum

tests/python/relax/test_tvmscript_parser_op_statistical.py:37–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35
36
37def test_sum():
38 @R.function
39 def foo(x: R.Tensor((1, 2, 3, 4), "float32")) -> R.Tensor((1, 3), "float32"):
40 gv: R.Tensor((1, 3), "float32") = R.sum(x, axis=[1, 3])
41 return gv
42
43 x = relax.Var("x", R.Tensor((1, 2, 3, 4), "float32"))
44 bb = relax.BlockBuilder()
45 with bb.function("foo", [x]):
46 gv = bb.emit(relax.op.sum(x, axis=[1, 3]))
47 bb.emit_func_output(gv)
48
49 _check(foo, bb.get()["foo"])
50
51
52def test_sum_without_specified_axis():

Callers

nothing calls this directly

Calls 7

functionMethod · 0.95
emitMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
TensorMethod · 0.80
_checkFunction · 0.70
sumMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…