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

Function ExampleFunctionPassFunction

tests/cpp/test_example.cc:82–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82void ExampleFunctionPassFunction() {
83 namespace ffi = tvm::ffi;
84 // Create a function from a typed lambda
85 ffi::Function fapply = ffi::Function::FromTyped(
86 // NOLINTNEXTLINE(performance-unnecessary-value-param)
87 [](const ffi::Function f, ffi::Any param) { return f(param.cast<int>()); });
88 ffi::Function fadd1 = ffi::Function::FromTyped( //
89 [](const int a) -> int { return a + 1; });
90 int b = fapply(fadd1, 2).cast<int>();
91 EXPECT_EQ(b, 3);
92}
93
94void ExamplegGlobalFunctionRegistry() {
95 namespace ffi = tvm::ffi;

Callers 1

TESTFunction · 0.85

Calls 1

fapplyFunction · 0.85

Tested by

no test coverage detected