Package deepboof
Class BaseTensor
java.lang.Object
deepboof.BaseTensor
- All Implemented Interfaces:
ITensor
- Direct Known Subclasses:
BaseSpatialPadding2D,Tensor
Base class for all Tensor data types. Only provides information dealing with the tensor's shape
and core data type.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint[]Creates a new coordinate for this tensor.intReturns the number of dimensions in the tensorint[]getShape()Returns the internal array that specifies the tensor's shape.booleanisShape(int... shape) Checks to see if the supplied shape is the same as the tensor's shapeintlength(int dimension) Returns the length of a dimension/axis.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface deepboof.ITensor
getDataType
-
Field Details
-
shape
public int[] shapeThe lengths of each dimension/axis. Highest stride to smallest stride.
-
-
Constructor Details
-
BaseTensor
public BaseTensor()
-
-
Method Details
-
getShape
public int[] getShape()Returns the internal array that specifies the tensor's shape. DO NOT MODIFIY -
isShape
public boolean isShape(int... shape) Checks to see if the supplied shape is the same as the tensor's shape -
length
public int length(int dimension) Returns the length of a dimension/axis. If a negative number is passed in it will return the distance relative to the end. E.g. -1 = length-1, -2 = length-2 -
createCoor
public int[] createCoor()Creates a new coordinate for this tensor.- Specified by:
createCoorin interfaceITensor- Returns:
- coordinate/int array of appropriate length
-
getDimension
public int getDimension()Returns the number of dimensions in the tensor- Specified by:
getDimensionin interfaceITensor- Returns:
- number of dimensions
-