Package org.apache.tvm
Class Function
java.lang.Object
org.apache.tvm.TVMValue
org.apache.tvm.Function
TVM Packed Function.
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionEasy for user to get the instance from returned TVMValue.Invoke function with arguments.static Function
convertFunc
(Function.Callback function) Convert a Java function to TVM function.protected void
finalize()
static Function
getFunction
(String name) Get registered function.invoke()
Invoke the function.pushArg
(byte[] arg) Push argument to the function.pushArg
(double arg) Push argument to the function.pushArg
(float arg) Push argument to the function.pushArg
(int arg) Push argument to the function.pushArg
(long arg) Push argument to the function.Push argument to the function.Push argument to the function.Push argument to the function.Push argument to the function.pushArg
(NDArrayBase arg) Push argument to the function.static void
register
(String name, Function.Callback function) Register user-defined global function, do not override existing entry.static void
register
(String name, Function.Callback function, boolean override) Register user-defined global function.void
release()
Release the Function.
-
Field Details
-
isResident
public final boolean isResident
-
-
Method Details
-
getFunction
Get registered function.- Parameters:
name
- full function name.- Returns:
- TVM function.
-
finalize
-
asFunction
Easy for user to get the instance from returned TVMValue.- Overrides:
asFunction
in classTVMValue
- Returns:
- this
-
release
public void release()Release the Function.We highly recommend you to do this manually since the GC strategy is lazy.
-
invoke
Invoke the function.- Returns:
- the result.
-
pushArg
Push argument to the function.- Parameters:
arg
- int argument.- Returns:
- this
-
pushArg
Push argument to the function.- Parameters:
arg
- long argument.- Returns:
- this
-
pushArg
Push argument to the function.- Parameters:
arg
- float argument.- Returns:
- this
-
pushArg
Push argument to the function.- Parameters:
arg
- double argument.- Returns:
- this
-
pushArg
Push argument to the function.- Parameters:
arg
- String argument.- Returns:
- this
-
pushArg
Push argument to the function.- Parameters:
arg
- NDArray.- Returns:
- this
-
pushArg
Push argument to the function.- Parameters:
arg
- Module.- Returns:
- this
-
pushArg
Push argument to the function.- Parameters:
arg
- Function.- Returns:
- this
-
pushArg
Push argument to the function.- Parameters:
arg
- bytes.- Returns:
- this
-
pushArg
Push argument to the function.- Parameters:
arg
- Device.- Returns:
- this
-
call
Invoke function with arguments.- Parameters:
args
- Can be Integer, Long, Float, Double, String, NDArray.- Returns:
- the result.
-
register
Register user-defined global function.- Parameters:
name
- The function name.function
- The function to be registered.override
- Whether override existing entry.
-
register
Register user-defined global function, do not override existing entry.- Parameters:
name
- The function name.function
- The function to be registered.
-
convertFunc
Convert a Java function to TVM function.- Parameters:
function
- Java function.- Returns:
- TVM function.
-