Package deepboof.forward
Interface FunctionLinear<T extends Tensor>
- All Superinterfaces:
Function<T>
- All Known Implementing Classes:
FunctionLinear_F32,FunctionLinear_F64
public interface FunctionLinear<T extends Tensor> extends Function<T>
Applies a linear (or affine) equation to input array. This is a matrix multiplication operation that is
performed between the input vector and their respective weights plus bias.
y = W*x + bwhere y is the output, W are the weights, x is the input, and b is the bias.
-
Method Summary
Modifier and Type Method Description voidforward(T input, T output)Input tensor shape =(N, d[i], ...intgetNumberOfOutputs()Returns the number of output elements.voidsetParameters(java.util.List<T> parameters)Seeforward(T, T)for a description of parameters.Methods inherited from interface deepboof.Function
getOutputShape, getParameters, getParameterShapes, getTensorType, initialize
-
Method Details
-
forward
Input tensor shape =(N, d[i], ... , d[K])
where N is the number of stacked inputs, d[i] is the number of inputs along dimension i, and K is the dimension of the input space.Tensor Parameters:
Weight matrix shape=(M,D)
bias shape=(M)
where D is the total number of inputs (Product d[i]) and M is the number of outputs.NOTE: The tensor parameters' shape has been selected to minimize cache misses during matrix multiplication.
-
setParameters
Seeforward(T, T)for a description of parameters.- Specified by:
setParametersin interfaceFunction<T extends Tensor>- Parameters:
parameters- Weight and bias tensors with shapes (M, D), and (M,), respectively.
-
getNumberOfOutputs
int getNumberOfOutputs()Returns the number of output elements. This is the variable M.- Returns:
- Number of output elements.
-