Class AbstractTensor

java.lang.Object
smile.tensor.AbstractTensor
All Implemented Interfaces:
Tensor
Direct Known Subclasses:
JTensor

public abstract class AbstractTensor extends Object implements Tensor
This class provides a skeletal implementation of the Tensor interface, to minimize the effort required to implement this interface.
  • Constructor Details

    • AbstractTensor

      public AbstractTensor(int... shape)
      Constructor.
      Parameters:
      shape - the shape of tensor.
  • Method Details

    • dim

      public int dim()
      Description copied from interface: Tensor
      Returns the number of dimensions of tensor.
      Specified by:
      dim in interface Tensor
      Returns:
      the number of dimensions of tensor
    • size

      public int size(int dim)
      Description copied from interface: Tensor
      Returns the size of given dimension.
      Specified by:
      size in interface Tensor
      Parameters:
      dim - dimension index.
      Returns:
      the size of given dimension.
    • shape

      public int[] shape()
      Description copied from interface: Tensor
      Returns the shape of tensor. That is a list of the extent of each dimension.
      Specified by:
      shape in interface Tensor
      Returns:
      the shape of tensor.