tf.raw_ops.RandomCrop

Randomly crop image.

size is a 1-D int64 tensor with 2 elements representing the crop height and width. The values must be non negative.

This Op picks a random location in image and crops a height by width rectangle from that location. The random location is picked so the cropped area will fit inside the original image.

Args
image A Tensor. Must be one of the following types: uint8, int8, int16, int32, int64, float32, float64. 3-D of shape [height, width, channels].
size A Tensor of type int64. 1-D of length 2 containing: crop_height, crop_width..
seed An optional int. Defaults to 0. If either seed or seed2 are set to be non-zero, the random number generator is seeded by the given seed. Otherwise, it is seeded by a random seed.
seed2 An optional int. Defaults to 0. An second seed to avoid seed collision.
name A name for the operation (optional).
Returns
A Tensor. Has the same type as image.

© 2020 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/versions/r2.4/api_docs/python/tf/raw_ops/RandomCrop