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 of shape must be equal to or less than the rank of tensor. If the length of shape is less than the rank of tensor, the operation is applied along the last len(shape) dimensions of tensor. Any component of shape can be set to the special value -1 to leave the corresponding dimension unchanged.

Returns

A Tensor. Has the same type as tensor. The centrally cropped tensor.

Raises

ValueError – If shape has a rank other than 1.