Class IntDenseNdArray
java.lang.Object
org.tensorflow.ndarray.impl.dense.AbstractDenseNdArray<Integer, IntNdArray>
org.tensorflow.ndarray.impl.dense.IntDenseNdArray
- All Implemented Interfaces:
IntNdArray, NdArray<Integer>, Shaped
public class IntDenseNdArray
extends AbstractDenseNdArray<Integer, IntNdArray>
implements IntNdArray
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected IntDataBufferbuffer()copyFrom(IntDataBuffer src) copyTo(IntDataBuffer dst) Copy the content of this array to the destination array.static IntNdArraycreate(IntDataBuffer buffer, Shape shape) intgetInt(long... indices) Returns the integer value of the scalar found at the given coordinates.scalars()Returns a sequence of all scalars in this array.setInt(int value, long... indices) Assigns the integer value of the scalar found at the given coordinates.shape()protected booleanslowEquals(NdArray<?> array) protected intMethods inherited from class AbstractDenseNdArray
copyFrom, copyTo, elements, equals, get, getObject, hashCode, set, setObject, slice, slice, slowCopyTo, toString, withShapeMethods inherited from interface IntNdArray
copyFrom, copyTo, elements, get, getObject, scalars, set, setObject, slice, streamOfInts, withShapeMethods inherited from interface NdArray
equals, streamOfObjects
-
Field Details
-
dimensions
-
-
Constructor Details
-
IntDenseNdArray
-
-
Method Details
-
create
-
getInt
public int getInt(long... indices) Description copied from interface:IntNdArrayReturns the integer 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:
IntNdArray matrix = NdArrays.ofInts(shape(2, 2)); // matrix rank = 2 matrix.getInt(0, 1); // succeeds, returns 0 matrix.getInt(0); // throws IllegalRankException IntNdArray scalar = matrix.get(0, 1); // scalar rank = 0 scalar.getInt(); // succeeds, returns 0- Specified by:
getIntin interfaceIntNdArray- Parameters:
indices- coordinates of the scalar to resolve- Returns:
- value of that scalar
-
setInt
Description copied from interface:IntNdArrayAssigns the integer 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:
IntNdArray matrix = NdArrays.ofInts(shape(2, 2)); // matrix rank = 2 matrix.setInt(10, 0, 1); // succeeds matrix.setInt(10, 0); // throws IllegalRankException IntNdArray scalar = matrix.get(0, 1); // scalar rank = 0 scalar.setInt(10); // succeeds- Specified by:
setIntin interfaceIntNdArray- Parameters:
value- value to assignindices- coordinates of the scalar to assign- Returns:
- this array
-
copyTo
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 interfaceIntNdArray- Specified by:
copyToin interfaceNdArray<Integer>- Parameters:
dst- array to receive a copy of the content of this array- Returns:
- this array
-
copyTo
- Specified by:
copyToin interfaceIntNdArray
-
copyFrom
- Specified by:
copyFromin interfaceIntNdArray
-
buffer
- Specified by:
bufferin classAbstractDenseNdArray<Integer, IntNdArray>
-
dimensions
-
shape
-
scalars
Description copied from interface:NdArrayReturns a sequence of all scalars in this array.This is equivalent to call
elements(shape().numDimensions() - 1) -
slowHashCode
protected int slowHashCode() -
slowEquals
-