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

Function test_nested_function

tests/python/relax/test_tvmscript_printer_relax.py:141–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139
140
141def test_nested_function():
142 @I.ir_module(s_tir=True)
143 class NestedFunction:
144 @R.function
145 def main(x: R.Tensor((), "int32")) -> R.Tensor((), "int32"):
146 @R.function
147 def nested(y: R.Tensor((), "int32")) -> R.Tensor((), "int32"):
148 return y
149
150 z = nested(x)
151 return z
152
153 _assert_print(
154 NestedFunction,
155 """
156# from tvm.script import ir as I
157# from tvm.script import relax as R
158
159@I.ir_module
160class Module:
161 @R.function
162 def main(x: R.Tensor((), dtype="int32")) -> R.Tensor((), dtype="int32"):
163 # from tvm.script import relax as R
164
165 @R.function
166 def nested(y: R.Tensor((), dtype="int32")) -> R.Tensor((), dtype="int32"):
167 return y
168
169 z: R.Tensor((), dtype="int32") = nested(x)
170 return z
171""",
172 )
173
174
175def test_object_struct_info():

Callers

nothing calls this directly

Calls 1

_assert_printFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…