def register_shape_checker(left_type, right_type, shape_checker_function):
  """Register a new shape checking function supporting given types.

  Shape checkers are primarily used to make sure that the seed derivatives
  passed into generated autodiff functions match their corresponding
  primal values.

  Args:
    left_type: A Python type object. The data type of the left operand
      supported by the adder.
    right_type: A Python type object. The data type of the right operand
      supported by the adder.
    shape_checker_function: A binary function that takes two arguments, left and
      right, of the types left_type and right_type respectively, and returns
      a boolean indicating whether or not they match.

  Raises:
    ValueError: If the given type pair was already registered.
  """
  key = (left_type, right_type)
  if key in shape_checkers:
    raise ValueError('Types %s already mapped to %s' % (key,
                                                        shape_checkers[key]))
  shape_checkers[key] = shape_checker_function
def register_shape_checker ( left_type , right_type , shape_checker_function ) : key = ( left_type , right_type ) if key in shape_checkers : raise ValueError ( 'Types %s already mapped to %s' % ( key , shape_checkers [ key ] ) ) shape_checkers [ key ] = shape_checker_function
Register a new shape checking function supporting given types.

  Shape checkers are primarily used to make sure that the seed derivatives
  passed into generated autodiff functions match their corresponding
  primal values.

  Args:
    left_type: A Python type object. The data type of the left operand
      supported by the adder.
    right_type: A Python type object. The data type of the right operand
      supported by the adder.
    shape_checker_function: A binary function that takes two arguments, left and
      right, of the types left_type and right_type respectively, and returns
      a boolean indicating whether or not they match.

  Raises:
    ValueError: If the given type pair was already registered.