Package deepboof.misc
Class TensorFactory_F32
java.lang.Object
deepboof.misc.TensorFactory_F32
Various functions for unit tests
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Tensor_F32Creates a random tensor with the specified shape and values from -1 to 1static Tensor_F32Creates a random tensor with the specified shape and value rangestatic List<Tensor_F32>Creates a random tensor with the specified shape and value rangestatic voidrandomMM(Random rand, float min, float max, Tensor_F32 tensor) Fills the tensor with random numbers selected from a uniform distribution.static Tensor_F32Generate a zeros tensor with the option for a sub-tensor
-
Constructor Details
-
TensorFactory_F32
public TensorFactory_F32()
-
-
Method Details
-
zeros
Generate a zeros tensor with the option for a sub-tensor- Parameters:
rand- If you wish to generate a sub-matrix pass in this RNG and it will randomly offset the data. null for regular tensorshape- Shape of the tensor- Returns:
- tensor
-
random
Creates a random tensor with the specified shape and values from -1 to 1- Parameters:
rand- Random number generatorsubTensor- Should it be a sub-tensor or not?shape- Shape of the tensor- Returns:
- The random tensor
-
randomMM
public static Tensor_F32 randomMM(Random rand, boolean subTensor, float min, float max, int... shape) Creates a random tensor with the specified shape and value range- Parameters:
rand- Random number generatorsubTensor- Should it be a sub-tensor or not?min- Minimum value of each elementmax- Maximum value of each elementshape- Shape of the tensor- Returns:
- The random tensor
-
randomMM
public static List<Tensor_F32> randomMM(Random rand, boolean subTensor, float min, float max, List<int[]> shapes) Creates a random tensor with the specified shape and value range- Parameters:
rand- Random number generatorsubTensor- Should it be a sub-tensor or not?min- Minimum value of each elementmax- Maximum value of each elementshapes- Shapes of the tensors- Returns:
- The random tensor
-
randomMM
Fills the tensor with random numbers selected from a uniform distribution.- Parameters:
rand- Random number generatormin- min value, inclusivemax- max value, inclusivetensor- Tensor that is to be filled.
-