public class Function extends TVMValue
| Modifier and Type | Class and Description |
|---|---|
static interface |
Function.Callback |
| Modifier and Type | Field and Description |
|---|---|
boolean |
isResident |
| Modifier and Type | Method and Description |
|---|---|
Function |
asFunction()
Easy for user to get the instance from returned TVMValue.
|
TVMValue |
call(Object... args)
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.
|
TVMValue |
invoke()
Invoke the function.
|
Function |
pushArg(byte[] arg)
Push argument to the function.
|
Function |
pushArg(double arg)
Push argument to the function.
|
Function |
pushArg(float arg)
Push argument to the function.
|
Function |
pushArg(Function arg)
Push argument to the function.
|
Function |
pushArg(int arg)
Push argument to the function.
|
Function |
pushArg(long arg)
Push argument to the function.
|
Function |
pushArg(Module arg)
Push argument to the function.
|
Function |
pushArg(NDArrayBase arg)
Push argument to the function.
|
Function |
pushArg(String 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.
|
public static Function getFunction(String name)
name - full function name.protected void finalize()
throws Throwable
public Function asFunction()
asFunction in class TVMValuepublic void release()
We highly recommend you to do this manually since the GC strategy is lazy.
public TVMValue invoke()
public Function pushArg(int arg)
arg - int argument.public Function pushArg(long arg)
arg - long argument.public Function pushArg(float arg)
arg - float argument.public Function pushArg(double arg)
arg - double argument.public Function pushArg(String arg)
arg - String argument.public Function pushArg(NDArrayBase arg)
arg - NDArray.public Function pushArg(Module arg)
arg - Module.public Function pushArg(Function arg)
arg - Function.public Function pushArg(byte[] arg)
arg - bytes.public TVMValue call(Object... args)
args - Can be Integer, Long, Float, Double, String, NDArray.public static void register(String name, Function.Callback function, boolean override)
name - The function name.function - The function to be registered.override - Whether override existing entry.public static void register(String name, Function.Callback function)
name - The function name.function - The function to be registered.public static Function convertFunc(Function.Callback function)
function - Java function.Copyright © 2024. All rights reserved.