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

Function test_break_loop

tests/python/tirx-base/test_tir_base.py:117–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

115
116
117def test_break_loop():
118 @T.prim_func(s_tir=True)
119 def func(In: T.Buffer((2,), "int32"), Out: T.Buffer((2,), "int32")):
120 Out[0] = 0
121 Out[1] = 1
122 for i in range(10):
123 for j in range(10):
124 if i * 10 + j == In[0]:
125 Out[0] = i + j
126 break
127 if Out[0] > 0:
128 break
129 while Out[1] > 0:
130 Out[1] = Out[1] + 1
131 if Out[1] > In[1]:
132 break
133
134 func = build_tir_func(func)
135 a = np.asarray([49, 8], "int32")
136 b = np.zeros([2], "int32")
137 if not hasattr(b, "__dlpack__"):
138 return
139 func(a, b)
140 assert b[0] == 13
141 assert b[1] == 9
142
143
144def test_continue_loop():

Callers

nothing calls this directly

Calls 3

build_tir_funcFunction · 0.85
funcFunction · 0.70
zerosMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…