public interface NumericalGradient<T extends deepboof.Tensor<T>>
Given a Function implementations of this interface will compute the gradient of its
inputs and parameters. Numerical differentiation is done using a symmetric sample, e.g.
dx = [f(x+T)-f(x-T)]/T
| Modifier and Type | Method and Description |
|---|---|
void |
configure(double T)
Overrides default settings for computing numerical gradient.
|
void |
differentiate(T input,
java.util.List<T> parameters,
T dout,
T gradientInput,
java.util.List<T> gradientParameters)
Performs numerical differentiation to compute the gradients of input and parameters.
|
void |
setFunction(deepboof.Function<T> function)
Sets the function which will be differentiated and other parameters.
|
void configure(double T)
T - Sampling distance used for numerical differentiationvoid setFunction(deepboof.Function<T> function)
Function.initialize(int...) should have already been called.function - The function which is to be differentiatedvoid differentiate(T input, java.util.List<T> parameters, T dout, T gradientInput, java.util.List<T> gradientParameters)
input and parameters will be modified
and then returned to their original state.input - The same input tensor which was passed in during the forward pass.parameters - The same parameters which was passed in during the forward pass.dout - Derivative of output, computed from next layer.gradientInput - Storage for gradient of inputgradientParameters - Storage for gradients of parameters