Class: TorchVision::Transforms::CenterCrop

Inherits:
Torch::NN::Module
  • Object
show all
Defined in:
lib/torchvision/transforms/center_crop.rb

Instance Method Summary collapse

Constructor Details

#initialize(size) ⇒ CenterCrop

Returns a new instance of CenterCrop.



4
5
6
# File 'lib/torchvision/transforms/center_crop.rb', line 4

def initialize(size)
  @size = size
end

Instance Method Details

#forward(img) ⇒ Object



8
9
10
# File 'lib/torchvision/transforms/center_crop.rb', line 8

def forward(img)
  F.center_crop(img, @size)
end