tf.random_crop(value, size, seed=None, name=None)
See the guide: Constants, Sequences, and Random Values > Random Tensors
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]
.
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 tf.set_random_seed
for behavior.name
: A name for this operation (optional).A cropped tensor of the same rank as value
and shape size
.
Defined in tensorflow/python/ops/random_ops.py
.
© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/random_crop