Class LongDenseNdArray

java.lang.Object
org.tensorflow.ndarray.impl.dense.AbstractDenseNdArray<Long, LongNdArray>
org.tensorflow.ndarray.impl.dense.LongDenseNdArray
All Implemented Interfaces:
LongNdArray, NdArray<Long>, Shaped

public class LongDenseNdArray extends AbstractDenseNdArray<Long, LongNdArray> implements LongNdArray
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public static LongNdArray create(LongDataBuffer buffer, Shape shape)
    • getLong

      public long getLong(long... indices)
      Description copied from interface: LongNdArray
      Returns the long 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:

       LongNdArray matrix = NdArrays.ofLongs(shape(2, 2));  // matrix rank = 2
       matrix.getLong(0, 1);  // succeeds, returns 0L
       matrix.getLong(0);  // throws IllegalRankException
      
       LongNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
       scalar.getLong();  // succeeds, returns 0L
      
      Specified by:
      getLong in interface LongNdArray
      Parameters:
      indices - coordinates of the scalar to resolve
      Returns:
      value of that scalar
    • setLong

      public LongNdArray setLong(long value, long... indices)
      Description copied from interface: LongNdArray
      Assigns the long 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:

       LongNdArray matrix = NdArrays.ofLongs(shape(2, 2));  // matrix rank = 2
       matrix.setLong(10L, 0, 1);  // succeeds
       matrix.setLong(10L, 0);  // throws IllegalRankException
      
       LongNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
       scalar.setLong(10L);  // succeeds
      
      Specified by:
      setLong in interface LongNdArray
      Parameters:
      value - value to assign
      indices - coordinates of the scalar to assign
      Returns:
      this array
    • copyTo

      public LongNdArray copyTo(NdArray<Long> dst)
      Description copied from interface: NdArray
      Copy 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:
      copyTo in interface LongNdArray
      Specified by:
      copyTo in interface NdArray<Long>
      Parameters:
      dst - array to receive a copy of the content of this array
      Returns:
      this array
    • copyTo

      public LongNdArray copyTo(LongDataBuffer dst)
      Specified by:
      copyTo in interface LongNdArray
    • copyFrom

      public LongNdArray copyFrom(LongDataBuffer src)
      Specified by:
      copyFrom in interface LongNdArray
    • buffer

      protected LongDataBuffer buffer()
      Specified by:
      buffer in class AbstractDenseNdArray<Long, LongNdArray>
    • dimensions

      public DimensionalSpace dimensions()
    • shape

      public Shape shape()
      Specified by:
      shape in interface Shaped
      Returns:
      the shape of this container
    • scalars

      public NdArraySequence<LongNdArray> scalars()
      Description copied from interface: NdArray
      Returns a sequence of all scalars in this array.

      This is equivalent to call elements(shape().numDimensions() - 1)

      Specified by:
      scalars in interface NdArray<T>
      Returns:
      an NdArray sequence
    • slowHashCode

      protected int slowHashCode()
    • slowEquals

      protected boolean slowEquals(NdArray<?> array)