parameters: (grad_ys, ys, colocate_gradients_with_ops)
return_statement: return grad_ys
docstring: Fill in default values for grad_ys.
  
    Args:
      grad_ys: List of gradients, can contain None.
      ys: List of tensors.
      colocate_gradients_with_ops: If True, try colocating gradients with
        the corresponding op.
  
    Returns:
      A list of gradients to use, without None.
  
    Raises:
      ValueError: If sizes of gradients and inputs don't match
      TypeError: If type of any gradient is not valid for its input.
docstring_summary: Fill in default values for grad_ys.
docstring_tokens: Fill in default values for grad_ys .
function: def _DefaultGradYs(grad_ys, ys, colocate_gradients_with_ops):
    """Fill in default values for grad_ys.
  
    Args:
      grad_ys: List of gradients, can contain None.
      ys: List of tensors.
      colocate_gradients_with_ops: If True, try colocating gradients with
        the corresponding op.
  
    Returns:
      A list of gradients to use, without None.
  
    Raises:
      ValueError: If sizes of gradients and inputs don't match
      TypeError: If type of any gradient is not valid for its input.
    """
    if len(grad_ys) != len(ys):
      raise ValueError("Passed %d grad_ys for %d ys" % (len(grad_ys), len(ys)))
    grad_ys = ops.convert_n_to_tensor_or_indexed_slices(grad_ys, name="grad_y")
    for i in xrange(len(grad_ys)):
      grad_y = grad_ys[i]
      y = ys[i]
      if grad_y is None:
        if y.dtype.is_complex:
          raise TypeError(
              "Gradients of complex tensors must set grad_ys (y.dtype = %r)" %
              y.dtype)
        with _maybe_colocate_with(y.op, colocate_gradients_with_ops):
          grad_ys[i] = array_ops.fill(
              array_ops.shape(y), constant_op.constant(
                  1, dtype=y.dtype))
        continue
      if y.dtype.is_floating or y.dtype.is_integer:
        if not grad_y.dtype.is_floating and not grad_y.dtype.is_integer:
          raise TypeError("Gradient type %s generated for real or "
                           "integer-valued tensor %s with type %s must be "
                           "real or integer" %
                           (dtypes.as_dtype(grad_y.dtype).name, y,
                            dtypes.as_dtype(y.dtype).name))
      elif y.dtype.is_complex:
        if not grad_y.dtype.is_complex:
          raise TypeError("Gradient type %s generated for complex-valued "
                           "tensor %s with type %s must be real" %
                           (dtypes.as_dtype(grad_y.dtype).name, y,
                            dtypes.as_dtype(y.dtype).name))
      else:
        raise TypeError("Tensor %s with type %s must be numeric "
                        "to obtain a default gradient" %
                        (y, dtypes.as_dtype(y.dtype).name))
    return grad_ys
function_tokens: def _DefaultGradYs ( grad_ys , ys , colocate_gradients_with_ops ) : if len ( grad_ys ) != len ( ys ) : raise ValueError ( "Passed %d grad_ys for %d ys" % ( len ( grad_ys ) , len ( ys ) ) ) grad_ys = ops . convert_n_to_tensor_or_indexed_slices ( grad_ys , name = "grad_y" ) for i in xrange ( len ( grad_ys ) ) : grad_y = grad_ys [ i ] y = ys [ i ] if grad_y is None : if y . dtype . is_complex : raise TypeError ( "Gradients of complex tensors must set grad_ys (y.dtype = %r)" % y . dtype ) with _maybe_colocate_with ( y . op , colocate_gradients_with_ops ) : grad_ys [ i ] = array_ops . fill ( array_ops . shape ( y ) , constant_op . constant ( 1 , dtype = y . dtype ) ) continue if y . dtype . is_floating or y . dtype . is_integer : if not grad_y . dtype . is_floating and not grad_y . dtype . is_integer : raise TypeError ( "Gradient type %s generated for real or " "integer-valued tensor %s with type %s must be " "real or integer" % ( dtypes . as_dtype ( grad_y . dtype ) . name , y , dtypes . as_dtype ( y . dtype ) . name ) ) elif y . dtype . is_complex : if not grad_y . dtype . is_complex : raise TypeError ( "Gradient type %s generated for complex-valued " "tensor %s with type %s must be real" % ( dtypes . as_dtype ( grad_y . dtype ) . name , y , dtypes . as_dtype ( y . dtype ) . name ) ) else : raise TypeError ( "Tensor %s with type %s must be numeric " "to obtain a default gradient" % ( y , dtypes . as_dtype ( y . dtype ) . name ) ) return grad_ys