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

Method main

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

Source from the content-addressed store, hash-verified

105
106 @R.function
107 def main(x: R.Tensor((2, 4), dtype="float32")) -> R.Tensor((10,), dtype="float32"):
108 R.func_attr({"relax.force_pure": True})
109 cls = Expected
110 storage: R.Object = R.memory.alloc_storage(R.shape([32]), virtual_device_index=0, storage_scope="global", dtype="float32")
111 alloc: R.Tensor((2, 4), dtype="float32") = R.memory.alloc_tensor(storage, 0, R.shape([2, 4]), dtype="float32")
112 _ = cls.exp(x, alloc)
113 lv: R.Tensor((2, 4), dtype="float32") = alloc
114 lv1: R.Tensor((8,), dtype="float32") = R.reshape(lv, (8,))
115 storage1: R.Object = R.memory.alloc_storage(R.shape([40]), virtual_device_index=0, storage_scope="global", dtype="float32")
116 alloc1: R.Tensor((8,), dtype="float32") = R.memory.alloc_tensor(storage1, 0, R.shape([8]), dtype="float32")
117 _ = cls.relu(lv1, alloc1)
118 lv2: R.Tensor((8,), dtype="float32") = alloc1
119 alloc2: R.Tensor((8,), dtype="float32") = R.memory.alloc_tensor(storage, 0, R.shape([8]), dtype="float32")
120 _ = cls.add(lv2, R.const(1, "float32"), alloc2)
121 lv3: R.Tensor((8,), dtype="float32") = alloc2
122 alloc3: R.Tensor((10,), dtype="float32") = R.memory.alloc_tensor(storage1, 0, R.shape([10]), dtype="float32")
123 _ = cls.pad(lv3, alloc3)
124 lv4: R.Tensor((10,), dtype="float32") = alloc3
125 alloc4: R.Tensor((10,), dtype="float32") = R.builtin.alloc_tensor(R.shape([10]), dtype="float32", runtime_device_index=0)
126 _ = cls.log(lv4, alloc4)
127 gv5: R.Tensor((10,), dtype="float32") = alloc4
128 return gv5
129
130 @I.ir_module
131 class ExpectedLowered:

Callers

nothing calls this directly

Calls 15

TensorMethod · 0.80
call_packedMethod · 0.80
maxMethod · 0.80
ShapeMethod · 0.80
dataflowMethod · 0.80
outputMethod · 0.80
shapeMethod · 0.45
expMethod · 0.45
reshapeMethod · 0.45
reluMethod · 0.45
addMethod · 0.45
padMethod · 0.45

Tested by

no test coverage detected