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

Function test_allreduce_infer_struct_info

tests/python/relax/test_op_ccl.py:39–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38
39def test_allreduce_infer_struct_info():
40 bb = relax.BlockBuilder()
41 x0 = relax.Var("x", R.Tensor((2, 3), "float32"))
42 x1 = relax.Var("x", R.Tensor("float32", ndim=3))
43 x2 = relax.Var("x", R.Tensor("float32", ndim=-1))
44 x3 = relax.Var("x", R.Tensor((2, 3)))
45 x4 = relax.Var("x", R.Tensor())
46 x5 = relax.Var("x", R.Tensor((3, 4)))
47
48 _check_inference(bb, relax.op.ccl.allreduce(x0), relax.TensorStructInfo((2, 3), "float32"))
49 _check_inference(
50 bb, relax.op.ccl.allreduce(x1), relax.TensorStructInfo(dtype="float32", ndim=3)
51 )
52 _check_inference(bb, relax.op.ccl.allreduce(x2), relax.TensorStructInfo(dtype="float32"))
53 _check_inference(bb, relax.op.ccl.allreduce(x3), relax.TensorStructInfo((2, 3), dtype=""))
54 _check_inference(bb, relax.op.ccl.allreduce(x4), relax.TensorStructInfo(dtype=""))
55 _check_inference(bb, relax.op.ccl.allreduce(x5), relax.TensorStructInfo((3, 4), dtype=""))
56
57
58def test_allreduce_infer_struct_info_shape_symbolic():

Callers

nothing calls this directly

Calls 3

TensorMethod · 0.80
allreduceMethod · 0.80
_check_inferenceFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…