parameters: (labeled_tensor, shape_map, seed=None, name=None)
docstring: Randomly crops a tensor to a given size.
  
    See tf.random_crop.
  
    Args:
      labeled_tensor: The input tensor.
      shape_map: A dictionary mapping axis names to the size of the random crop
        for that dimension.
      seed: An optional random seed.
      name: An optional op name.
  
    Returns:
      A tensor of the same rank as `labeled_tensor`, cropped randomly in the
      selected dimensions.
  
    Raises:
      ValueError: If the shape map contains an axis name not in the input tensor.
docstring_summary: Randomly crops a tensor to a given size.
docstring_tokens: Randomly crops a tensor to a given size .
function: def random_crop(labeled_tensor, shape_map, seed=None, name=None):
    """Randomly crops a tensor to a given size.
  
    See tf.random_crop.
  
    Args:
      labeled_tensor: The input tensor.
      shape_map: A dictionary mapping axis names to the size of the random crop
        for that dimension.
      seed: An optional random seed.
      name: An optional op name.
  
    Returns:
      A tensor of the same rank as `labeled_tensor`, cropped randomly in the
      selected dimensions.
  
    Raises:
      ValueError: If the shape map contains an axis name not in the input tensor.
    """
    with ops.name_scope(name, 'lt_random_crop', [labeled_tensor]) as scope:
      labeled_tensor = core.convert_to_labeled_tensor(labeled_tensor)
  
      for axis_name in shape_map:
        if axis_name not in labeled_tensor.axes:
          raise ValueError('Selection axis %s not in axes %s' %
                           (axis_name, labeled_tensor.axes))
  
      shape = []
      axes = []
      for axis in labeled_tensor.axes.values():
        if axis.name in shape_map:
          size = shape_map[axis.name]
          shape.append(size)
          # We lose labels for the axes we crop, leaving just the size.
          axes.append((axis.name, size))
        else:
          shape.append(len(axis))
          axes.append(axis)
  
      crop_op = random_ops.random_crop(
          labeled_tensor.tensor, shape, seed=seed, name=scope)
  
      return core.LabeledTensor(crop_op, axes)
function_tokens: def random_crop ( labeled_tensor , shape_map , seed = None , name = None ) : with ops . name_scope ( name , 'lt_random_crop' , [ labeled_tensor ] ) as scope : labeled_tensor = core . convert_to_labeled_tensor ( labeled_tensor ) for axis_name in shape_map : if axis_name not in labeled_tensor . axes : raise ValueError ( 'Selection axis %s not in axes %s' % ( axis_name , labeled_tensor . axes ) ) shape = [ ] axes = [ ] for axis in labeled_tensor . axes . values ( ) : if axis . name in shape_map : size = shape_map [ axis . name ] shape . append ( size ) # We lose labels for the axes we crop, leaving just the size. axes . append ( ( axis . name , size ) ) else : shape . append ( len ( axis ) ) axes . append ( axis ) crop_op = random_ops . random_crop ( labeled_tensor . tensor , shape , seed = seed , name = scope ) return core . LabeledTensor ( crop_op , axes )