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

Method main

docs/how_to/tutorials/mix_python_and_tvm_with_pymodule.py:363–369  ·  view source on GitHub ↗
(
            x: R.Tensor((4, 8), "float32"),
        )

Source from the content-addressed store, hash-verified

361
362 @R.function
363 def main(
364 x: R.Tensor((4, 8), "float32"),
365 ) -> R.Tensor((4, 8), "float32"):
366 # The VM calls back into Python for these two ops
367 h = R.call_py_func("layer_norm", (x,), out_sinfo=R.Tensor((4, 8), "float32"))
368 out = R.call_py_func("silu", (h,), out_sinfo=R.Tensor((4, 8), "float32"))
369 return out
370
371 mod = HybridVMModule(device=tvm.cpu(0))
372 x = torch.randn(4, 8)

Callers

nothing calls this directly

Calls 2

TensorMethod · 0.80
call_py_funcMethod · 0.80

Tested by

no test coverage detected