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

Function test_clip

tests/python/relax/test_codegen_coreml.py:171–197  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169
170@requires_coreml_runtime
171def test_clip():
172 x = relax.Var("x", relax.TensorStructInfo([10, 10], "float32"))
173 bb = relax.BlockBuilder()
174
175 with bb.function("main", [x]):
176 with bb.dataflow():
177 lv0 = bb.emit(relax.op.clip(x, 0, 4))
178 gv0 = bb.emit_output(lv0)
179 bb.emit_func_output(gv0)
180 mod = bb.get()
181
182 x_data = tvm.runtime.tensor(np.random.rand(10, 10).astype("float32"), dev)
183 verify(mod, [x_data])
184
185 x = relax.Var("x", relax.TensorStructInfo([10, 10], "float32"))
186 bb = relax.BlockBuilder()
187
188 with bb.function("main", [x]):
189 with bb.dataflow():
190 lv0 = bb.emit(relax.op.clip(x, 0, 4))
191 lv1 = bb.emit(relax.op.clip(x, 1, 3))
192 gv0 = bb.emit_output(lv0)
193 gv1 = bb.emit_output(lv1)
194 bb.emit_func_output([gv0, gv1])
195
196 x_data = tvm.runtime.tensor(np.random.rand(10, 10).astype("float32"), dev)
197 verify(mod, [x_data])
198
199
200@requires_coreml_runtime

Callers

nothing calls this directly

Calls 8

functionMethod · 0.95
dataflowMethod · 0.95
emitMethod · 0.95
emit_outputMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
verifyFunction · 0.70
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…