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

Function test_relax_base_op

tests/python/relax/test_tvmscript_parser.py:382–396  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

380
381
382def test_relax_base_op():
383 @R.function
384 def foo(x: R.Tensor((4, 4), "float32")):
385 alloc = R.builtin.alloc_tensor(R.shape([4, 4]), runtime_device_index=0, dtype="float32")
386 shape = R.shape_of(alloc)
387 return shape
388
389 x = relax.Var("x", R.Tensor((4, 4), "float32"))
390 bb = relax.BlockBuilder()
391 with bb.function("foo", (x,)):
392 alloc = bb.emit(relax.op.builtin.alloc_tensor(relax.ShapeExpr((4, 4)), "float32", 0))
393 shape = bb.emit(relax.op.shape_of(alloc))
394 bb.emit_func_output(shape)
395
396 _check(foo, bb.get()["foo"])
397
398
399def test_relax_shape_to_tensor():

Callers

nothing calls this directly

Calls 7

functionMethod · 0.95
emitMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
TensorMethod · 0.80
shape_ofMethod · 0.80
_checkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…