MCPcopy
hub / github.com/apache/tvm / main

Method main

tests/python/relax/test_transform_static_plan_block_memory.py:58–78  ·  view source on GitHub ↗
(x: R.Tensor((2, 4), dtype="float32"))

Source from the content-addressed store, hash-verified

56
57 @R.function
58 def main(x: R.Tensor((2, 4), dtype="float32")) -> R.Tensor((10,), dtype="float32"):
59 # we expected RemovePurityChecking to have been invoked first
60 R.func_attr({"relax.force_pure": True})
61 cls = Module
62 alloc: R.Tensor((2, 4), dtype="float32") = R.builtin.alloc_tensor(R.shape([2, 4]), dtype="float32", runtime_device_index=0)
63 _: R.Tuple() = cls.exp(x, alloc)
64 lv: R.Tensor((2, 4), dtype="float32") = alloc
65 lv1: R.Tensor((8,), dtype="float32") = R.reshape(lv, (8,))
66 alloc1: R.Tensor((8,), dtype="float32") = R.builtin.alloc_tensor(R.shape([8]), dtype="float32", runtime_device_index=0)
67 _1: R.Tuple() = cls.relu(lv1, alloc1)
68 lv2: R.Tensor((8,), dtype="float32") = alloc1
69 alloc2: R.Tensor((8,), dtype="float32") = R.builtin.alloc_tensor(R.shape([8]), dtype="float32", runtime_device_index=0)
70 _2: R.Tuple() = cls.add(lv2, R.const(1, "float32"), alloc2)
71 lv3: R.Tensor((8,), dtype="float32") = alloc2
72 alloc3: R.Tensor((10,), dtype="float32") = R.builtin.alloc_tensor(R.shape([10]), dtype="float32", runtime_device_index=0)
73 _3: R.Tuple() = cls.pad(lv3, alloc3)
74 lv4: R.Tensor((10,), dtype="float32") = alloc3
75 alloc4: R.Tensor((10,), dtype="float32") = R.builtin.alloc_tensor(R.shape([10]), dtype="float32", runtime_device_index=0)
76 _4: R.Tuple() = cls.log(lv4, alloc4)
77 gv: R.Tensor((10,), dtype="float32") = alloc4
78 return gv
79
80 @tvm.script.ir_module
81 class Expected:

Calls 15

TensorMethod · 0.80
all_less_than_zeroMethod · 0.80
call_packedMethod · 0.80
maxMethod · 0.80
ShapeMethod · 0.80
shapeMethod · 0.45
expMethod · 0.45
reshapeMethod · 0.45
reluMethod · 0.45
addMethod · 0.45
padMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected