- java.lang.Object
-
- org.tensorflow.ndarray.impl.AbstractNdArray<T,U>
-
- org.tensorflow.ndarray.impl.dense.AbstractDenseNdArray<Byte,ByteNdArray>
-
- org.tensorflow.ndarray.impl.dense.ByteDenseNdArray
-
- All Implemented Interfaces:
ByteNdArray,NdArray<Byte>,Shaped
public class ByteDenseNdArray extends AbstractDenseNdArray<Byte,ByteNdArray> implements ByteNdArray
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedByteDenseNdArray(ByteDataBuffer buffer, Shape shape)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ByteDataBufferbuffer()ByteNdArraycopyTo(NdArray<Byte> dst)Copy the content of this array to the destination array.static ByteNdArraycreate(ByteDataBuffer buffer, Shape shape)bytegetByte(long... indices)Returns the byte value of the scalar found at the given coordinates.ByteNdArrayread(ByteDataBuffer dst)ByteNdArraysetByte(byte value, long... indices)Assigns the byte value of the scalar found at the given coordinates.ByteNdArraywrite(ByteDataBuffer src)-
Methods inherited from class org.tensorflow.ndarray.impl.dense.AbstractDenseNdArray
elements, equals, get, getObject, hashCode, read, set, setObject, slice, slice, slowCopyTo, toString, write
-
Methods inherited from class org.tensorflow.ndarray.impl.AbstractNdArray
dimensions, scalars, shape, slowEquals, slowHashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.tensorflow.ndarray.ByteNdArray
elements, get, getObject, read, scalars, set, setObject, slice, write
-
Methods inherited from interface org.tensorflow.ndarray.NdArray
equals, streamOfObjects
-
-
-
-
Constructor Detail
-
ByteDenseNdArray
protected ByteDenseNdArray(ByteDataBuffer buffer, Shape shape)
-
-
Method Detail
-
create
public static ByteNdArray create(ByteDataBuffer buffer, Shape shape)
-
getByte
public byte getByte(long... indices)
Description copied from interface:ByteNdArrayReturns the byte value of the scalar found at the given coordinates.To access the scalar element, the number of coordinates provided must be equal to the number of dimensions of this array (i.e. its rank). For example:
ByteNdArray matrix = NdArrays.ofBytes(shape(2, 2)); // matrix rank = 2 matrix.getByte(0, 1); // succeeds, returns 0 matrix.getByte(0); // throws IllegalRankException ByteNdArray scalar = matrix.get(0, 1); // scalar rank = 0 scalar.getByte(); // succeeds, returns 0- Specified by:
getBytein interfaceByteNdArray- Parameters:
indices- coordinates of the scalar to resolve- Returns:
- value of that scalar
-
setByte
public ByteNdArray setByte(byte value, long... indices)
Description copied from interface:ByteNdArrayAssigns the byte value of the scalar found at the given coordinates.To access the scalar element, the number of coordinates provided must be equal to the number of dimensions of this array (i.e. its rank). For example:
ByteNdArray matrix = NdArrays.ofBytes(shape(2, 2)); // matrix rank = 2 matrix.setByte(10, 0, 1); // succeeds matrix.setByte(10, 0); // throws IllegalRankException ByteNdArray scalar = matrix.get(0, 1); // scalar rank = 0 scalar.setByte(10); // succeeds- Specified by:
setBytein interfaceByteNdArray- Parameters:
value- the value to assignindices- coordinates of the scalar to assign- Returns:
- this array
-
copyTo
public ByteNdArray copyTo(NdArray<Byte> dst)
Description copied from interface:NdArrayCopy the content of this array to the destination array.The
Shaped.shape()of the destination array must be equal to the shape of this array, or an exception is thrown. After the copy, the content of both arrays can be altered independently, without affecting each other.- Specified by:
copyToin interfaceByteNdArray- Specified by:
copyToin interfaceNdArray<Byte>- Parameters:
dst- array to receive a copy of the content of this array- Returns:
- this array
-
read
public ByteNdArray read(ByteDataBuffer dst)
- Specified by:
readin interfaceByteNdArray
-
write
public ByteNdArray write(ByteDataBuffer src)
- Specified by:
writein interfaceByteNdArray
-
buffer
protected ByteDataBuffer buffer()
- Specified by:
bufferin classAbstractDenseNdArray<Byte,ByteNdArray>
-
-