Interface GradientNumerical<T>

All Known Implementing Classes:
GradientNumerical_F64

public interface GradientNumerical<T>
Given a CROperatorForward 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
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    configure(double T)
    Overrides default settings for computing numerical gradient.
    void
    differentiate(CRArray<T> dout, List<CRArray<T>> gradInput)
    Performs numerical differentiation to compute the gradients of input and parameters.
    void
    setFunction(List<CRArray<T>> inputs, CROperatorForward<T> function)
    Sets the function which will be differentiated and other parameters.
  • Method Details

    • configure

      void configure(double T)
      Overrides default settings for computing numerical gradient.
      Parameters:
      T - Sampling distance used for numerical differentiation
    • setFunction

      void setFunction(List<CRArray<T>> inputs, CROperatorForward<T> function)
      Sets the function which will be differentiated and other parameters.
      Parameters:
      inputs - Value of all inputs passed into the function
      function - The function which is to be differentiated
    • differentiate

      void differentiate(CRArray<T> dout, List<CRArray<T>> gradInput)
      Performs numerical differentiation to compute the gradients of input and parameters. The value of parameters will be the current parameters stored in the function.
      Parameters:
      dout - (Input) Output's Jacobian, computed from next layer.
      gradInput - (Output) Storage for input gradients