Method: TorchVision::Transforms::Functional.crop
- Defined in:
- lib/torchvision/transforms/functional.rb
.crop(img, top, left, height, width) ⇒ Object
111 112 113 114 115 116 117 118 119 |
# File 'lib/torchvision/transforms/functional.rb', line 111 def crop(img, top, left, height, width) if img.is_a?(Torch::Tensor) assert_image_tensor(img) indexes = [true] * (img.dim - 2) img[*indexes, top...(top + height), left...(left + width)] else img.crop(left, top, width, height) end end |