tensorflow_mri.central_crop
tensorflow_mri.central_crop¶
- central_crop(tensor, shape)[source]¶
Crop the central region of a tensor.
- Parameters
tensor – A
Tensor
.shape – A
Tensor
. The shape of the region to crop. The length ofshape
must be equal to or less than the rank oftensor
. If the length ofshape
is less than the rank of tensor, the operation is applied along the lastlen(shape)
dimensions oftensor
. Any component ofshape
can be set to the special value -1 to leave the corresponding dimension unchanged.
- Returns
A
Tensor
. Has the same type astensor
. The centrally cropped tensor.- Raises
ValueError – If
shape
has a rank other than 1.