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

Method getGlobalFunc

jvm/core/src/main/java/org/apache/tvm/Function.java:53–65  ·  view source on GitHub ↗

Get a global function by name. @param name The name of the function. @param allowMissing Whether allow missing function or raise an error. @return The function to be returned, None if function is missing.

(String name, boolean allowMissing)

Source from the content-addressed store, hash-verified

51 * @return The function to be returned, None if function is missing.
52 */
53 private static Function getGlobalFunc(String name, boolean allowMissing) {
54 Base.RefLong handle = new Base.RefLong();
55 Base.checkCall(Base._LIB.tvmFFIFunctionGetGlobal(name, handle));
56 if (handle.value != 0) {
57 return new Function(handle.value);
58 } else {
59 if (allowMissing) {
60 return null;
61 } else {
62 throw new IllegalArgumentException("Cannot find global function " + name);
63 }
64 }
65 }
66
67 Function(long handle) {
68 super(handle, TypeIndex.kTVMFFIFunction);

Callers 1

getFunctionMethod · 0.95

Calls 2

checkCallMethod · 0.95

Tested by

no test coverage detected