Package deepboof.tensors
Class Tensor_F32
- All Implemented Interfaces:
ITensor
-
Field Summary
FieldsFields inherited from class deepboof.Tensor
startIndex, strides, subtensorFields inherited from class deepboof.BaseTensor
shape -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(int... shape) Creates a tensor of the same type with the specified shapefloatget(int... coordinate) floatgetAtIndex(int index) getData()Returns internal array used to store tensor data.Classof primitive data type used to store tensordoublegetDouble(int... coordinate) Accessor function which allows any tensor's element to be read as a double.protected voidinnerArrayGrow(int N) Re-declare inner array so that it is at least of length Nprotected intLength of inner array as returned by "data.length"voidUsed to change the internal array in an abstract wayvoidzero()Sets all elements in the tensor to the value of zeroMethods inherited from class deepboof.Tensor
computeStrides, copy, copyShape, createCoor, createLike, idx, idx, idx, idx, idx, idx, indexToCoor, isSub, length, length, reshape, reshape, reshape, reshape, reshape, reshape, reshape, setTo, stride, subtensorMethods inherited from class deepboof.BaseTensor
getDimension, getShape, isShape
-
Field Details
-
d
public float[] dStorage for tensor data. The tensor is stored in a row-major format.
-
-
Constructor Details
-
Tensor_F32
public Tensor_F32(int... shape) -
Tensor_F32
public Tensor_F32()
-
-
Method Details
-
get
public float get(int... coordinate) -
getAtIndex
public float getAtIndex(int index) -
getDouble
public double getDouble(int... coordinate) Description copied from class:TensorAccessor function which allows any tensor's element to be read as a double.- Specified by:
getDoublein classTensor<Tensor_F32>- Parameters:
coordinate- Coordinate of the element which is to be read- Returns:
- Tensor elements's value as a double
-
getData
Description copied from class:TensorReturns internal array used to store tensor data. Data is stored in a row-major order in a single array.- Specified by:
getDatain classTensor<Tensor_F32>- Returns:
- tensor data.
-
setData
Description copied from class:TensorUsed to change the internal array in an abstract way- Specified by:
setDatain classTensor<Tensor_F32>
-
innerArrayGrow
protected void innerArrayGrow(int N) Description copied from class:TensorRe-declare inner array so that it is at least of length N- Specified by:
innerArrayGrowin classTensor<Tensor_F32>- Parameters:
N- Desired minimum length of inner array
-
innerArrayLength
protected int innerArrayLength()Description copied from class:TensorLength of inner array as returned by "data.length"- Specified by:
innerArrayLengthin classTensor<Tensor_F32>- Returns:
- Length of inner array
-
create
Description copied from class:TensorCreates a tensor of the same type with the specified shape- Specified by:
createin classTensor<Tensor_F32>- Parameters:
shape- Shape of the new tensor- Returns:
- New tensor with the specified shape
-
zero
public void zero()Description copied from class:TensorSets all elements in the tensor to the value of zero- Specified by:
zeroin classTensor<Tensor_F32>
-
getDataType
Description copied from interface:ITensorClassof primitive data type used to store tensor- Returns:
- Internal data type class.
-