parameters: (op)
docstring: Shape function for the Pad op.
  
    This op has two inputs:
  
    * input: A rank-N tensor.
    * paddings: An N-by-2 matrix, in which the i^th row contains the
      number of padding elements to add before and after `input` in the
      i^th dimension.
  
    It has one output, which has the same rank as input, and additional
    elements according to the values in paddings.
  
    Args:
      op: A Pad Operation.
  
    Returns:
      A single-element list containing the shape of the output.
  
    Raises:
      ValueError: If the input shapes are incompatible.
docstring_summary: Shape function for the Pad op.
docstring_tokens: Shape function for the Pad op .
function: def _PadShape(op):
    """Shape function for the Pad op.
  
    This op has two inputs:
  
    * input: A rank-N tensor.
    * paddings: An N-by-2 matrix, in which the i^th row contains the
      number of padding elements to add before and after `input` in the
      i^th dimension.
  
    It has one output, which has the same rank as input, and additional
    elements according to the values in paddings.
  
    Args:
      op: A Pad Operation.
  
    Returns:
      A single-element list containing the shape of the output.
  
    Raises:
      ValueError: If the input shapes are incompatible.
    """
    paddings_shape = op.inputs[1].get_shape().with_rank(2)
    input_shape = op.inputs[0].get_shape()
    input_shape = input_shape.with_rank(paddings_shape[0].value)
    paddings_shape = paddings_shape.merge_with(
        tensor_shape.matrix(input_shape.ndims, 2))
    paddings = tensor_util.constant_value(op.inputs[1])
    if paddings is None:
      return [tensor_shape.unknown_shape(ndims=input_shape.ndims)]
    else:
      output_dims = []
      for i, dim in enumerate(input_shape.dims):
        if paddings[i, 0] < 0 or paddings[i, 1] < 0:
          raise ValueError("paddings must be non-negative")
        output_dims.append(dim + paddings[i, 0] + paddings[i, 1])
      return [tensor_shape.TensorShape(output_dims)]
function_tokens: def _PadShape ( op ) : paddings_shape = op . inputs [ 1 ] . get_shape ( ) . with_rank ( 2 ) input_shape = op . inputs [ 0 ] . get_shape ( ) input_shape = input_shape . with_rank ( paddings_shape [ 0 ] . value ) paddings_shape = paddings_shape . merge_with ( tensor_shape . matrix ( input_shape . ndims , 2 ) ) paddings = tensor_util . constant_value ( op . inputs [ 1 ] ) if paddings is None : return [ tensor_shape . unknown_shape ( ndims = input_shape . ndims ) ] else : output_dims = [ ] for i , dim in enumerate ( input_shape . dims ) : if paddings [ i , 0 ] < 0 or paddings [ i , 1 ] < 0 : raise ValueError ( "paddings must be non-negative" ) output_dims . append ( dim + paddings [ i , 0 ] + paddings [ i , 1 ] ) return [ tensor_shape . TensorShape ( output_dims ) ]