public class TensorOps_F32
extends java.lang.Object
| Constructor and Description |
|---|
TensorOps_F32() |
| Modifier and Type | Method and Description |
|---|---|
static void |
elementAdd(Tensor_F32 A,
Tensor_F32 B,
Tensor_F32 output)
Performs element-wise addition between the two tensors and stores results in output.
|
static void |
elementMult(Tensor_F32 tensor,
float value)
Performs an element-wise scalar multiplication on the tensor
|
static void |
elementMult(Tensor_F32 input,
float value,
Tensor_F32 output)
Performs an element-wise scalar multiplication
|
static void |
elementMult(Tensor_F32 A,
Tensor_F32 B,
Tensor_F32 output)
Performs element-wise multiplication between the two tensors and stores results in output.
|
static float |
elementSum(Tensor_F32 tensor)
Computes the sum of all the elements in the tensor
|
static void |
fill(Tensor_F32 tensor,
float value)
Fills the tensor with the specified value
|
static void |
fillSpatialBorder(Tensor_F32 tensor,
int[] coor,
int borderY0,
int borderX0,
int borderY1,
int borderX1,
float value)
Fills the border with the specified value.
|
static void |
insertSpatial(Tensor_F32 src,
int[] srcCoor,
Tensor_F32 dst,
int[] dstCoor)
Inserts the spatial region of one tensor into another.
|
static void |
insertSubChannel(Tensor_F32 src,
int srcStartIndex,
int srcStride,
Tensor_F32 dst,
int dstStartIndex,
int dstStride,
int rows,
int columns)
Used to copy a sub-image between two image tensors.
|
static void |
printSpatial(Tensor_F32 tensor,
int batch,
int channel)
Prints a single batch and channel in a spatial tensor
|
public static void elementMult(Tensor_F32 tensor, float value)
tensor - Tensor which is multipliedvalue - value of the multiplicationpublic static void elementMult(Tensor_F32 input, float value, Tensor_F32 output)
input - Tensor which is multiplied (not modified)value - value of the multiplication (modified)output - Tensor where the results are storedpublic static void elementMult(Tensor_F32 A, Tensor_F32 B, Tensor_F32 output)
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]A - Input tensor. Can be the same as output.B - Input tensor. Can be the same as output.output - Output tensor.public static void elementAdd(Tensor_F32 A, Tensor_F32 B, Tensor_F32 output)
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]A - Input tensor. Can be the same as output.B - Input tensor. Can be the same as output.output - Output tensor.public static float elementSum(Tensor_F32 tensor)
tensor - Tensorpublic static void insertSubChannel(Tensor_F32 src, int srcStartIndex, int srcStride, Tensor_F32 dst, int dstStartIndex, int dstStride, int rows, int columns)
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 copiedpublic static void insertSpatial(Tensor_F32 src, int[] srcCoor, Tensor_F32 dst, int[] dstCoor)
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.public static void fillSpatialBorder(Tensor_F32 tensor, int[] coor, int borderY0, int borderX0, int borderY1, int borderX1, float value)
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 insertedpublic static void printSpatial(Tensor_F32 tensor, int batch, int channel)
tensor - The tensorbatch - Batch numberchannel - channelpublic static void fill(Tensor_F32 tensor, float value)
tensor - The tensorvalue - fill value