Caffe2 - Python API
A deep learning, cross platform ML framework
Public Member Functions | List of all members
caffe2.python.gradient_checker.GradientChecker Class Reference

Public Member Functions

def __init__ (self, stepsize, threshold, device_option=None, workspace_name="gradient_check", input_device_options=None)
 
def GetLossAndGrad (self, op, grad_ops, inputs, input_names, input_to_check, grad_name, outputs_with_grads)
 
def CheckSimple (self, op, inputs, input_to_check, outputs_with_grads, grad_ops=None, input_device_options=None)
 

Detailed Description

A gradient checker in Python.

This is not the most efficient way to check gradients, as the Python
interface will involve a lot of copies back and forth operations. Use at your
own risk.

Definition at line 155 of file gradient_checker.py.

Member Function Documentation

def caffe2.python.gradient_checker.GradientChecker.CheckSimple (   self,
  op,
  inputs,
  input_to_check,
  outputs_with_grads,
  grad_ops = None,
  input_device_options = None 
)
Checks the operator in a very simple fashion by stacking a sum of
squares on the top.

Inputs:
  op: the operator to be checked.
  inputs: the input data in numpy arrays.
  input_to_check: an index specifying which input blob we should
      check.
  outputs_with_grads: indices specifying which output blobs will we
      need to check gradients with. For these outputs, we will collect a
      squared sum and also feed in their gradients.
  grad_operator: the gradient operator. If not given, we will get the
      gradient operator from the gradient registry.
  input_device_options: an optional mapping from input names to
      DeviceOptions (to override the default DeviceOption)
Outputs:
  boolean: True if it passes, False if it does not pass.

Definition at line 237 of file gradient_checker.py.


The documentation for this class was generated from the following file: