- java.lang.Object
-
- org.tensorflow.ndarray.impl.buffer.layout.Float16Layout
-
- All Implemented Interfaces:
DataLayout<ShortDataBuffer,Float>,FloatDataLayout<ShortDataBuffer>
public final class Float16Layout extends Object implements FloatDataLayout<ShortDataBuffer>
Data layout that converts 32-bit floats from/to 16-bit, accordingly to the IEEE-754 half-precision floating point specification.
-
-
Constructor Summary
Constructors Constructor Description Float16Layout()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description floatreadFloat(ShortDataBuffer buffer, long index)Readsn = scale()values from the buffer at the given index and return them as a float.voidwriteFloat(ShortDataBuffer buffer, float value, long index)Writes a float into the buffer at the given index after converting it to the buffer type.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.tensorflow.ndarray.buffer.layout.DataLayout
scale
-
Methods inherited from interface org.tensorflow.ndarray.buffer.layout.FloatDataLayout
applyTo, readObject, writeObject
-
-
-
-
Method Detail
-
writeFloat
public void writeFloat(ShortDataBuffer buffer, float value, long index)
Description copied from interface:FloatDataLayoutWrites a float into the buffer at the given index after converting it to the buffer type.- Specified by:
writeFloatin interfaceFloatDataLayout<ShortDataBuffer>- Parameters:
buffer- the buffer to write tovalue- the float to convert and writeindex- index in the buffer where the converted value should be written- See Also:
FloatDataLayout.writeObject(DataBuffer, Float, long)
-
readFloat
public float readFloat(ShortDataBuffer buffer, long index)
Description copied from interface:FloatDataLayoutReadsn = scale()values from the buffer at the given index and return them as a float.- Specified by:
readFloatin interfaceFloatDataLayout<ShortDataBuffer>- Parameters:
buffer- the buffer to read fromindex- position of the buffer to read in the buffer- Returns:
- the float value
- See Also:
FloatDataLayout.readObject(DataBuffer, long)
-
-