parameters: (value, size, seed=None, name=None)
docstring: Randomly crops a tensor to a given size.
  
    Slices a shape `size` portion out of `value` at a uniformly chosen offset.
    Requires `value.shape >= size`.
  
    If a dimension should not be cropped, pass the full size of that dimension.
    For example, RGB images can be cropped with
    `size = [crop_height, crop_width, 3]`.
  
    Args:
      value: Input tensor to crop.
      size: 1-D tensor with size the rank of `value`.
      seed: Python integer. Used to create a random seed. See
        [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed)
        for behavior.
      name: A name for this operation (optional).
  
    Returns:
      A cropped tensor of the same rank as `value` and shape `size`.
docstring_summary: Randomly crops a tensor to a given size.
docstring_tokens: Randomly crops a tensor to a given size .
function: def random_crop(value, size, seed=None, name=None):
    """Randomly crops a tensor to a given size.
  
    Slices a shape `size` portion out of `value` at a uniformly chosen offset.
    Requires `value.shape >= size`.
  
    If a dimension should not be cropped, pass the full size of that dimension.
    For example, RGB images can be cropped with
    `size = [crop_height, crop_width, 3]`.
  
    Args:
      value: Input tensor to crop.
      size: 1-D tensor with size the rank of `value`.
      seed: Python integer. Used to create a random seed. See
        [`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed)
        for behavior.
      name: A name for this operation (optional).
  
    Returns:
      A cropped tensor of the same rank as `value` and shape `size`.
    """
    # TODO(shlens): Implement edge case to guarantee output size dimensions.
    # If size > value.shape, zero pad the result so that it always has shape
    # exactly size.
    with ops.op_scope([value, size], name, "random_crop") as name:
      value = ops.convert_to_tensor(value, name="value")
      size = ops.convert_to_tensor(size, dtype=dtypes.int32, name="size")
      shape = array_ops.shape(value)
      check = logging_ops.Assert(
          math_ops.reduce_all(shape >= size),
          ["Need value.shape >= size, got ", shape, size])
      shape = control_flow_ops.with_dependencies([check], shape)
      limit = shape - size + 1
      offset = random_uniform(
          array_ops.shape(shape),
          dtype=size.dtype,
          maxval=size.dtype.max,
          seed=seed) % limit
      return array_ops.slice(value, offset, size, name=name)
function_tokens: def random_crop ( value , size , seed = None , name = None ) : # TODO(shlens): Implement edge case to guarantee output size dimensions. # If size > value.shape, zero pad the result so that it always has shape # exactly size. with ops . op_scope ( [ value , size ] , name , "random_crop" ) as name : value = ops . convert_to_tensor ( value , name = "value" ) size = ops . convert_to_tensor ( size , dtype = dtypes . int32 , name = "size" ) shape = array_ops . shape ( value ) check = logging_ops . Assert ( math_ops . reduce_all ( shape >= size ) , [ "Need value.shape >= size, got " , shape , size ] ) shape = control_flow_ops . with_dependencies ( [ check ] , shape ) limit = shape - size + 1 offset = random_uniform ( array_ops . shape ( shape ) , dtype = size . dtype , maxval = size . dtype . max , seed = seed ) % limit return array_ops . slice ( value , offset , size , name = name )