Module org.tensorflow.ndarray
Interface ShortDataLayout<S extends DataBuffer<?>>
-
- Type Parameters:
S- type of buffer this layout can be applied to
- All Superinterfaces:
DataLayout<S,Short>
public interface ShortDataLayout<S extends DataBuffer<?>> extends DataLayout<S,Short>
ADataLayoutthat converts data stored in a buffer to shorts.- See Also:
DataLayout
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ShortDataBufferapplyTo(S buffer)Apply this layout to the provided buffer.default ShortreadObject(S buffer, long index)Readsn = scale()values from the buffer at the given index and return them as a single value in the user type.shortreadShort(S buffer, long index)Readsn = scale()buffer values at the given index and return them as a short.default voidwriteObject(S buffer, Short value, long index)Writes a user value into the buffer at the given index after converting it to the buffer type.voidwriteShort(S buffer, short value, long index)Writes a short into the buffer at the given index after converting it to the buffer type.-
Methods inherited from interface org.tensorflow.ndarray.buffer.layout.DataLayout
scale
-
-
-
-
Method Detail
-
applyTo
default ShortDataBuffer applyTo(S buffer)
Description copied from interface:DataLayoutApply this layout to the provided buffer.The returned
DataBufferinstance is simply a wrapper to the original buffer and does not have a backing storage of his own.- Specified by:
applyToin interfaceDataLayout<S extends DataBuffer<?>,Short>- Parameters:
buffer- the target buffer to apply this layout to- Returns:
- a buffer with this layout
-
writeShort
void writeShort(S buffer, short value, long index)
Writes a short into the buffer at the given index after converting it to the buffer type.- Parameters:
buffer- the buffer to write tovalue- the short to convert and writeindex- index in the buffer where the converted value should be written- See Also:
writeObject(DataBuffer, Short, long)
-
readShort
short readShort(S buffer, long index)
Readsn = scale()buffer values at the given index and return them as a short.- Parameters:
buffer- the buffer to read fromindex- position of the value to read in the buffer- Returns:
- the short value
- See Also:
readObject(DataBuffer, long)
-
writeObject
default void writeObject(S buffer, Short value, long index)
Description copied from interface:DataLayoutWrites a user value into the buffer at the given index after converting it to the buffer type.It is the responsibility of the implementors of this interface to write the converted value to the given buffer before this call returns, using the most appropriate method. For example, for a layout converting a
BigIntegerto a singlelong,@Override public void writeObject(LongDataBuffer buffer, BigInteger value, long index) { buffer.setLong(value.longValue(), index); }If a single user value scales over more than one buffer values,indexindicates the starting position of the sequence to be written to the buffer.- Specified by:
writeObjectin interfaceDataLayout<S extends DataBuffer<?>,Short>- Parameters:
buffer- the buffer to write tovalue- the value in the user type to convert and writeindex- index in the buffer where the converted value should be written
-
readObject
default Short readObject(S buffer, long index)
Description copied from interface:DataLayoutReadsn = scale()values from the buffer at the given index and return them as a single value in the user type.It is the responsibility of the implementors of this interface to read the value to be converted from the given buffer, using the most appropriate method. For example, for a layout that converting a single
longto aBigInteger,@Override public BigInteger readObject(LongDataBuffer buffer, long index) { return BigInteger.valueOf(buffer.getLong(index)); }If a single user value scales over more than one buffer values,indexindicates the starting position of the sequence to be read from the buffer.- Specified by:
readObjectin interfaceDataLayout<S extends DataBuffer<?>,Short>- Parameters:
buffer- the buffer to read fromindex- position of the buffer to read in the buffer- Returns:
- the converted value
-
-