parameters: (labeled_tensor, paddings, mode='CONSTANT', name=None)
docstring: Pads a tensor.
  
    See tf.pad.
  
    Args:
      labeled_tensor: The input tensor.
      paddings: A mapping where the keys are axis names and the values are
        tuples where the first element is the padding to insert at the beginning
        of the axis and the second is the padding to insert at the end of the
        axis.
      mode: One of "CONSTANT", "REFLECT", or "SYMMETRIC".
      name: Optional op name.
  
    Returns:
      A tensor with the indicated axes padded, optionally with those axes extended
      with the provided labels.
  
    Raises:
      ValueError: If the padded axes are not axes in the input tensor.
docstring_summary: Pads a tensor.
docstring_tokens: Pads a tensor .
function: def pad(labeled_tensor, paddings, mode='CONSTANT', name=None):
    """Pads a tensor.
  
    See tf.pad.
  
    Args:
      labeled_tensor: The input tensor.
      paddings: A mapping where the keys are axis names and the values are
        tuples where the first element is the padding to insert at the beginning
        of the axis and the second is the padding to insert at the end of the
        axis.
      mode: One of "CONSTANT", "REFLECT", or "SYMMETRIC".
      name: Optional op name.
  
    Returns:
      A tensor with the indicated axes padded, optionally with those axes extended
      with the provided labels.
  
    Raises:
      ValueError: If the padded axes are not axes in the input tensor.
    """
    with ops.name_scope(name, 'lt_pad', [labeled_tensor]) as scope:
      labeled_tensor = core.convert_to_labeled_tensor(labeled_tensor)
  
      if not set(paddings.keys()) <= set(labeled_tensor.axes.keys()):
        raise ValueError('pad axes %r are not contained in the set of axis '
                         'names %r on the input labeled tensor' %
                         (paddings.keys(), labeled_tensor.axes))
  
      new_axes = []
      padding_pairs = []
      for name, axis in labeled_tensor.axes.items():
        if name in paddings:
          padding_before, padding_after = paddings[name]
          axis_before = core.Axis(name, padding_before)
          axis_after = core.Axis(name, padding_after)
          new_axes.append(core.concat_axes([axis_before, axis, axis_after]))
          padding_pairs.append((len(axis_before), len(axis_after)))
        else:
          new_axes.append(axis)
          padding_pairs.append((0, 0))
  
      pad_op = array_ops.pad(labeled_tensor.tensor,
                             padding_pairs,
                             mode,
                             name=scope)
  
      return core.LabeledTensor(pad_op, new_axes)
function_tokens: def pad ( labeled_tensor , paddings , mode = 'CONSTANT' , name = None ) : with ops . name_scope ( name , 'lt_pad' , [ labeled_tensor ] ) as scope : labeled_tensor = core . convert_to_labeled_tensor ( labeled_tensor ) if not set ( paddings . keys ( ) ) <= set ( labeled_tensor . axes . keys ( ) ) : raise ValueError ( 'pad axes %r are not contained in the set of axis ' 'names %r on the input labeled tensor' % ( paddings . keys ( ) , labeled_tensor . axes ) ) new_axes = [ ] padding_pairs = [ ] for name , axis in labeled_tensor . axes . items ( ) : if name in paddings : padding_before , padding_after = paddings [ name ] axis_before = core . Axis ( name , padding_before ) axis_after = core . Axis ( name , padding_after ) new_axes . append ( core . concat_axes ( [ axis_before , axis , axis_after ] ) ) padding_pairs . append ( ( len ( axis_before ) , len ( axis_after ) ) ) else : new_axes . append ( axis ) padding_pairs . append ( ( 0 , 0 ) ) pad_op = array_ops . pad ( labeled_tensor . tensor , padding_pairs , mode , name = scope ) return core . LabeledTensor ( pad_op , new_axes )