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

Function test_roi_align

tests/python/relax/test_tvmscript_parser_op_vision.py:320–349  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

318
319
320def test_roi_align():
321 @R.function
322 def foo(
323 x: R.Tensor((1, 2, 8, 8), "float32"),
324 rois: R.Tensor((2, 5), "float32"),
325 ) -> R.Tensor((2, 2, 3, 3), "float32"):
326 gv: R.Tensor((2, 2, 3, 3), "float32") = R.vision.roi_align(
327 x,
328 rois,
329 pooled_size=(3, 3),
330 spatial_scale=1.0,
331 sample_ratio=2,
332 layout="NCHW",
333 mode="avg",
334 )
335 return gv
336
337 x = relax.Var("x", R.Tensor((1, 2, 8, 8), "float32"))
338 rois = relax.Var("rois", R.Tensor((2, 5), "float32"))
339
340 bb = relax.BlockBuilder()
341 with bb.function("foo", [x, rois]):
342 gv = bb.emit(
343 relax.op.vision.roi_align(
344 x, rois, (3, 3), 1.0, sample_ratio=2, layout="NCHW", mode="avg"
345 )
346 )
347 bb.emit_func_output(gv)
348
349 _check(foo, bb.get()["foo"])
350
351
352if __name__ == "__main__":

Callers

nothing calls this directly

Calls 6

functionMethod · 0.95
emitMethod · 0.95
emit_func_outputMethod · 0.95
getMethod · 0.95
TensorMethod · 0.80
_checkFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…