MCPcopy Create free account
hub / github.com/apache/tvm-ffi / ExampleFunctionFromPacked

Function ExampleFunctionFromPacked

tests/cpp/test_example.cc:61–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59TEST(Example, Any) { ExampleAny(); }
60
61void ExampleFunctionFromPacked() {
62 namespace ffi = tvm::ffi;
63 // Create a function from a typed lambda
64 ffi::Function fadd1 =
65 ffi::Function::FromPacked([](const ffi::AnyView* args, int32_t num_args, ffi::Any* rv) {
66 TVM_FFI_ICHECK_EQ(num_args, 1);
67 int a = args[0].cast<int>();
68 *rv = a + 1;
69 });
70 int b = fadd1(1).cast<int>();
71 EXPECT_EQ(b, 2);
72}
73
74void ExampleFunctionFromTyped() {
75 namespace ffi = tvm::ffi;

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected