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=caffe2_pb2.DeviceOption(), workspace_name="gradient_check")
def GetLossAndGrad (self, op, grad_ops, x, input_name, 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 164 of file

Member Function Documentation

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

  op: the operator to be checked.
  inputs: the input data in numpy arrays.
  input_to_check: an index specifying which input blob we should
  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)
  boolean: True if it passes, False if it does not pass.

Definition at line 238 of file

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