Class: TorchVision::Transforms::Compose

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

Instance Method Summary collapse

Constructor Details

#initialize(transforms) ⇒ Compose

Returns a new instance of Compose.



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

def initialize(transforms)
  @transforms = transforms
end

Instance Method Details

#forward(img) ⇒ Object



8
9
10
11
12
13
# File 'lib/torchvision/transforms/compose.rb', line 8

def forward(img)
  @transforms.each do |t|
    img = t.call(img)
  end
  img
end