MCPcopy Index your code
hub / github.com/apache/tvm / test_linear

Function test_linear

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

Source from the content-addressed store, hash-verified

53
54
55def test_linear():
56 @R.function
57 def foo(
58 x: R.Tensor((2, 3, 4, 5), "float32"),
59 w: R.Tensor((3, 5), "float32"),
60 bias: R.Tensor((3,), "float32"),
61 ):
62 gv = R.linear(x, w, bias)
63 return gv
64
65 x = relax.Var("x", R.Tensor((2, 3, 4, 5), "float32"))
66 w = relax.Var("y", R.Tensor((3, 5), "float32"))
67 bias = relax.Var("bias", R.Tensor((3,), "float32"))
68 bb = relax.BlockBuilder()
69 with bb.function("foo", [x, w, bias]):
70 w_T = bb.emit(relax.op.permute_dims(w, axes=None))
71 matmul = bb.emit(relax.op.matmul(x, w_T))
72 out = matmul + bias
73 bb.emit_func_output(out)
74
75 _check(foo, bb.get()["foo"])
76
77
78def test_einsum():

Callers

nothing calls this directly

Calls 8

functionMethod · 0.95
emitMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
TensorMethod · 0.80
_checkFunction · 0.70
permute_dimsMethod · 0.45
matmulMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…