Package deepboof.misc
Class TensorOps_F64
java.lang.Object
deepboof.misc.TensorOps_F64
public class TensorOps_F64
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description TensorOps_F64() -
Method Summary
Modifier and Type Method Description static voidelementAdd(Tensor_F64 A, Tensor_F64 B, Tensor_F64 output)Performs element-wise addition between the two tensors and stores results in output.static voidelementMult(Tensor_F64 tensor, double value)Performs an element-wise scalar multiplication on the tensorstatic voidelementMult(Tensor_F64 input, double value, Tensor_F64 output)Performs an element-wise scalar multiplicationstatic voidelementMult(Tensor_F64 A, Tensor_F64 B, Tensor_F64 output)Performs element-wise multiplication between the two tensors and stores results in output.static doubleelementSum(Tensor_F64 tensor)Computes the sum of all the elements in the tensorstatic voidfill(Tensor_F64 tensor, double value)Fills the tensor with the specified valuestatic voidfillSpatialBorder(Tensor_F64 tensor, int[] coor, int borderY0, int borderX0, int borderY1, int borderX1, double value)Fills the border with the specified value.static voidinsertSpatial(Tensor_F64 src, int[] srcCoor, Tensor_F64 dst, int[] dstCoor)Inserts the spatial region of one tensor into another.static voidinsertSubChannel(Tensor_F64 src, int srcStartIndex, int srcStride, Tensor_F64 dst, int dstStartIndex, int dstStride, int rows, int columns)Used to copy a sub-image between two image tensors.static voidprintSpatial(Tensor_F64 tensor, int batch, int channel)Prints a single batch and channel in a spatial tensor
-
Constructor Details
-
TensorOps_F64
public TensorOps_F64()
-
-
Method Details
-
elementMult
Performs an element-wise scalar multiplication on the tensor- Parameters:
tensor- Tensor which is multipliedvalue- value of the multiplication
-
elementMult
Performs an element-wise scalar multiplication- Parameters:
input- Tensor which is multiplied (not modified)value- value of the multiplication (modified)output- Tensor where the results are stored
-
elementMult
Performs element-wise multiplication between the two tensors and stores results in output. All tensors must have the same shape.
output[i] = A[i]*B[i]- Parameters:
A- Input tensor. Can be the same as output.B- Input tensor. Can be the same as output.output- Output tensor.
-
elementAdd
Performs element-wise addition between the two tensors and stores results in output. All tensors must have the same shape.
output[i] = A[i] + B[i]- Parameters:
A- Input tensor. Can be the same as output.B- Input tensor. Can be the same as output.output- Output tensor.
-
elementSum
Computes the sum of all the elements in the tensor- Parameters:
tensor- Tensor
-
insertSubChannel
public static void insertSubChannel(Tensor_F64 src, int srcStartIndex, int srcStride, Tensor_F64 dst, int dstStartIndex, int dstStride, int rows, int columns)Used to copy a sub-image between two image tensors.- Parameters:
src- Source tensorsrcStartIndex- Start index in input tensor.srcStride- Row-stride for input tensordst- Destination tensordstStartIndex- Start index in destination tensor.dstStride- Row-stride for destination tensorrows- Number of rows to be copiedcolumns- Number of columns to be copied
-
insertSpatial
Inserts the spatial region of one tensor into another. Both tensors are assumed to follow the following pattern for their shape. (..., C, H, W). C is for the number of channels, H is for the image's height, and W, is for the image's width.- Parameters:
src- Source tensor. Entire image is copied into dst.srcCoor- Coordinate of spatial region. ( ..., 0, 0, 0) modified.dst- Destination tensor. The source image can be smaller than the destination, but not larger.dstCoor- Coordinate of spatial region. ( ..., 0, y, x) modified.
-
fillSpatialBorder
public static void fillSpatialBorder(Tensor_F64 tensor, int[] coor, int borderY0, int borderX0, int borderY1, int borderX1, double value)Fills the border with the specified value. The tensor is assumed to have the following shape ( ... , C , H, W), C is for he number of channels, H is for the image's height, and W, is for the image's width.- Parameters:
tensor- Tensor with a spatial region at the end. Modified.coor- Coordinate of the targeted spatial region inside the tensor. axis values for C,H,W are ignored. Modified.borderY0- Lower extent's border length along Y axisborderX0- Lower extent's border length along X axisborderY1- Upper extent's border length along Y axisborderX1- Upper extent's border length along X axisvalue- Value that is to be inserted
-
printSpatial
Prints a single batch and channel in a spatial tensor- Parameters:
tensor- The tensorbatch- Batch numberchannel- channel
-
fill
Fills the tensor with the specified value- Parameters:
tensor- The tensorvalue- fill value
-