tensorflow/lite/g3doc/api_docs/java/org/tensorflow/lite/support/tensorbuffer/TensorBufferFloat.html
public final class TensorBufferFloat
Represents data buffer with float values.
| DataType | getDataType() Returns the data type of this buffer.
| | float[] | getFloatArray() Returns a float array of the values stored in this buffer.
| | float | getFloatValue(int absIndex) Returns a float value at a given index.
| | int[] | getIntArray() Returns an int array of the values stored in this buffer.
| | int | getIntValue(int absIndex) Returns an int value at a given index.
| | int | getTypeSize() Returns the number of bytes of a single element in the array.
| | void | loadArray(int[] src, int[] shape) Loads an int array into this buffer with specific shape.
| | void | loadArray(float[] src, int[] shape) Loads a float array into this buffer with specific shape.
|
From class org.tensorflow.lite.support.tensorbuffer.TensorBuffer
| static TensorBuffer |
createDynamic(DataType dataType)
Creates an empty dynamic TensorBuffer with specified DataType.
|
| static TensorBuffer |
createFixedSize(int[] shape, DataType dataType)
Creates a TensorBuffer with specified shape and DataType.
|
| static TensorBuffer |
createFrom(TensorBuffer buffer, DataType dataType)
Creates a TensorBuffer deep-copying data from another, with specified DataType.
| | ByteBuffer | getBuffer() Returns the data buffer.
| | abstract DataType | getDataType() Returns the data type of this buffer.
| | int | getFlatSize() Gets the flatSize of the buffer.
| | abstract float[] | getFloatArray() Returns a float array of the values stored in this buffer.
| | abstract float | getFloatValue(int absIndex) Returns a float value at a given index.
| | abstract int[] | getIntArray() Returns an int array of the values stored in this buffer.
| | abstract int | getIntValue(int absIndex) Returns an int value at a given index.
| | int[] | getShape() Gets the current shape.
| | abstract int | getTypeSize() Returns the number of bytes of a single element in the array.
|
| boolean |
isDynamic()
Returns if the TensorBuffer is dynamic sized (could resize arbitrarily).
| | abstract void | loadArray(int[] src, int[] shape) Loads an int array into this buffer with specific shape.
| | abstract void | loadArray(float[] src, int[] shape) Loads a float array into this buffer with specific shape.
| | void | loadArray(float[] src) Loads a float array into this buffer.
| | void | loadArray(int[] src) Loads an int array into this buffer.
|
| void |
loadBuffer(ByteBuffer buffer)
Loads a byte buffer into this TensorBuffer.
|
| void |
loadBuffer(ByteBuffer buffer, int[] shape)
Loads a byte buffer into this TensorBuffer with specific shape.
|
From class java.lang.Object
| boolean | equals(Object arg0) | | final Class<?> | getClass() | | int | hashCode() | | final void | notify() | | final void | notifyAll() | | String | toString() | | final void | wait(long arg0, int arg1) | | final void | wait(long arg0) | | final void | wait() |
Returns the data type of this buffer.
Returns a float array of the values stored in this buffer. If the buffer is of different types than float, the values will be converted into float. For example, values in TensorBufferUint8 will be converted from uint8 to float.
Returns a float value at a given index. If the buffer is of different types than float, the value will be converted into float. For example, when reading a value from TensorBufferUint8, the value will be first read out as uint8, and then will be converted from uint8 to float.
For example, a TensorBuffer with shape {2, 3} that represents the following array,
[[0.0f, 1.0f, 2.0f], [3.0f, 4.0f, 5.0f]].
The fourth element (whose value is 3.0f) in the TensorBuffer can be retrieved by:
float v = tensorBuffer.getFloatValue(3);
| absIndex | The absolute index of the value to be read. |
Returns an int array of the values stored in this buffer. If the buffer is of different type than int, the values will be converted into int, and loss of precision may apply. For example, getting an int array from a TensorBufferFloat with values {400.32f, 23.04f}, the output is {400, 23}.
Returns an int value at a given index. If the buffer is of different types than int, the value will be converted into int. For example, when reading a value from TensorBufferFloat, the value will be first read out as float, and then will be converted from float to int. Loss of precision may apply.
For example, a TensorBuffer with shape {2, 3} that represents the following array,
[[0.0f, 1.0f, 2.0f], [3.0f, 4.0f, 5.0f]].
The fourth element (whose value is 3.0f) in the TensorBuffer can be retrieved by:
int v = tensorBuffer.getIntValue(3);
Note that v is converted from 3.0f to 3 as a result of type conversion.
| absIndex | The absolute index of the value to be read. |
Returns the number of bytes of a single element in the array. For example, a float buffer will return 4, and a byte buffer will return 1.
Loads an int array into this buffer with specific shape. If the buffer is of different types than int, the values will be converted into the buffer's type before being loaded into the buffer, and loss of precision may apply. For example, loading an int array with values {400, -23} into a TensorBufferUint8 , the values will be clamped to [0, 255] and then be casted to uint8 by {255, 0}.
| src | The source array to be loaded. |
| shape | Shape of the tensor that src represents. |
Loads a float array into this buffer with specific shape. If the buffer is of different types than float, the values will be converted into the buffer's type before being loaded into the buffer, and loss of precision may apply. For example, loading a float array into a TensorBufferUint8 with values {400.32f, -23.04f}, the values will be clamped to [0, 255] and then be casted to uint8 by {255, 0}.
| src | The source array to be loaded. |
| shape | Shape of the tensor that src represents. |