public class TensorFlowInferenceInterface extends Object
| Constructor and Description |
|---|
TensorFlowInferenceInterface(android.content.res.AssetManager assetManager,
String model) |
TensorFlowInferenceInterface(Graph g) |
TensorFlowInferenceInterface(InputStream is) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Cleans up the state associated with this Object.
|
void |
feed(String inputName,
boolean[] src,
long... dims)
Given a source array with shape
dims and content src, copy the contents into
the input Tensor with name inputName. |
void |
feed(String inputName,
byte[] src,
long... dims)
Given a source array with shape
dims and content src, copy the contents into
the input Tensor with name inputName. |
void |
feed(String inputName,
ByteBuffer src,
long... dims)
Given a source buffer with shape
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. |
void |
feed(String inputName,
double[] src,
long... dims)
Given a source array with shape
dims and content src, copy the contents into
the input Tensor with name inputName. |
void |
feed(String inputName,
DoubleBuffer src,
long... dims)
Given a source buffer with shape
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. |
void |
feed(String inputName,
float[] src,
long... dims)
Given a source array with shape
dims and content src, copy the contents into
the input Tensor with name inputName. |
void |
feed(String inputName,
FloatBuffer src,
long... dims)
Given a source buffer with shape
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. |
void |
feed(String inputName,
int[] src,
long... dims)
Given a source array with shape
dims and content src, copy the contents into
the input Tensor with name inputName. |
void |
feed(String inputName,
IntBuffer src,
long... dims)
Given a source buffer with shape
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. |
void |
feed(String inputName,
long[] src,
long... dims)
Given a source array with shape
dims and content src, copy the contents into
the input Tensor with name inputName. |
void |
feed(String inputName,
LongBuffer src,
long... dims)
Given a source buffer with shape
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. |
void |
feedString(String inputName,
byte[] src)
Copy a byte sequence into the input Tensor with name
inputName as a string-valued
scalar tensor. |
void |
feedString(String inputName,
byte[][] src)
Copy an array of byte sequences into the input Tensor with name
inputName as a
string-valued one-dimensional tensor (vector). |
void |
fetch(String outputName,
byte[] dst)
Read from a Tensor named
outputName and copy the contents into a Java array. |
void |
fetch(String outputName,
ByteBuffer dst)
Read from a Tensor named
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. |
void |
fetch(String outputName,
double[] dst)
Read from a Tensor named
outputName and copy the contents into a Java array. |
void |
fetch(String outputName,
DoubleBuffer dst)
Read from a Tensor named
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. |
void |
fetch(String outputName,
float[] dst)
Read from a Tensor named
outputName and copy the contents into a Java array. |
void |
fetch(String outputName,
FloatBuffer dst)
Read from a Tensor named
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. |
void |
fetch(String outputName,
int[] dst)
Read from a Tensor named
outputName and copy the contents into a Java array. |
void |
fetch(String outputName,
IntBuffer dst)
Read from a Tensor named
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. |
void |
fetch(String outputName,
long[] dst)
Read from a Tensor named
outputName and copy the contents into a Java array. |
void |
fetch(String outputName,
LongBuffer dst)
Read from a Tensor named
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. |
protected void |
finalize() |
String |
getStatString()
Returns the last stat summary string if logging is enabled.
|
Graph |
graph()
Returns a reference to the Graph describing the computation run during inference.
|
Operation |
graphOperation(String operationName) |
void |
run(String[] outputNames)
Runs inference between the previously registered input nodes (via feed*) and the requested
output nodes.
|
void |
run(String[] outputNames,
boolean enableStats)
Runs inference between the previously registered input nodes (via feed*) and the requested
output nodes.
|
void |
run(String[] outputNames,
boolean enableStats,
String[] targetNodeNames)
An overloaded version of runInference that allows supplying targetNodeNames as well
|
public TensorFlowInferenceInterface(android.content.res.AssetManager assetManager,
String model)
public TensorFlowInferenceInterface(InputStream is)
public TensorFlowInferenceInterface(Graph g)
public void run(String[] outputNames)
outputNames - A list of output nodes which should be filled by the inference pass.public void run(String[] outputNames, boolean enableStats)
outputNames - A list of output nodes which should be filled by the inference pass.public void run(String[] outputNames, boolean enableStats, String[] targetNodeNames)
public Graph graph()
public String getStatString()
public void close()
The TenosrFlowInferenceInterface object is no longer usable after this method returns.
protected void finalize()
throws Throwable
public void feed(String inputName, boolean[] src, long... dims)
dims and content src, copy the contents into
the input Tensor with name inputName. The source array src must have at least
as many elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feed(String inputName, float[] src, long... dims)
dims and content src, copy the contents into
the input Tensor with name inputName. The source array src must have at least
as many elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feed(String inputName, int[] src, long... dims)
dims and content src, copy the contents into
the input Tensor with name inputName. The source array src must have at least
as many elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feed(String inputName, long[] src, long... dims)
dims and content src, copy the contents into
the input Tensor with name inputName. The source array src must have at least
as many elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feed(String inputName, double[] src, long... dims)
dims and content src, copy the contents into
the input Tensor with name inputName. The source array src must have at least
as many elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feed(String inputName, byte[] src, long... dims)
dims and content src, copy the contents into
the input Tensor with name inputName. The source array src must have at least
as many elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feedString(String inputName, byte[] src)
inputName as a string-valued
scalar tensor. In the TensorFlow type system, a "string" is an arbitrary sequence of bytes, not
a Java String (which is a sequence of characters).public void feedString(String inputName, byte[][] src)
inputName as a
string-valued one-dimensional tensor (vector). In the TensorFlow type system, a "string" is an
arbitrary sequence of bytes, not a Java String (which is a sequence of characters).public void feed(String inputName, FloatBuffer src, long... dims)
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. The source buffer src must have at least as many
elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feed(String inputName, IntBuffer src, long... dims)
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. The source buffer src must have at least as many
elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feed(String inputName, LongBuffer src, long... dims)
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. The source buffer src must have at least as many
elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feed(String inputName, DoubleBuffer src, long... dims)
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. The source buffer src must have at least as many
elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void feed(String inputName, ByteBuffer src, long... dims)
dims and content src, both stored as
direct and native ordered java.nio buffers, copy the contents into the input
Tensor with name inputName. The source buffer src must have at least as many
elements as that of the destination Tensor. If src has more elements than the
destination has capacity, the copy is truncated.public void fetch(String outputName, float[] dst)
outputName and copy the contents into a Java array. dst must have length greater than or equal to that of the source Tensor. This operation will
not affect dst's content past the source Tensor's size.public void fetch(String outputName, int[] dst)
outputName and copy the contents into a Java array. dst must have length greater than or equal to that of the source Tensor. This operation will
not affect dst's content past the source Tensor's size.public void fetch(String outputName, long[] dst)
outputName and copy the contents into a Java array. dst must have length greater than or equal to that of the source Tensor. This operation will
not affect dst's content past the source Tensor's size.public void fetch(String outputName, double[] dst)
outputName and copy the contents into a Java array. dst must have length greater than or equal to that of the source Tensor. This operation will
not affect dst's content past the source Tensor's size.public void fetch(String outputName, byte[] dst)
outputName and copy the contents into a Java array. dst must have length greater than or equal to that of the source Tensor. This operation will
not affect dst's content past the source Tensor's size.public void fetch(String outputName, FloatBuffer dst)
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. dst must have capacity greater than
or equal to that of the source Tensor. This operation will not affect dst's content past the
source Tensor's size.public void fetch(String outputName, IntBuffer dst)
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. dst must have capacity greater than
or equal to that of the source Tensor. This operation will not affect dst's content past the
source Tensor's size.public void fetch(String outputName, LongBuffer dst)
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. dst must have capacity greater than
or equal to that of the source Tensor. This operation will not affect dst's content past the
source Tensor's size.public void fetch(String outputName, DoubleBuffer dst)
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. dst must have capacity greater than
or equal to that of the source Tensor. This operation will not affect dst's content past the
source Tensor's size.public void fetch(String outputName, ByteBuffer dst)
outputName and copy the contents into the direct and
native ordered java.nio buffer dst. dst must have capacity greater than
or equal to that of the source Tensor. This operation will not affect dst's content past the
source Tensor's size.Copyright © 2019. All rights reserved.