Sha256: 440e211984d36aaf755b4b412f297b1dc36bf402d5d0e331c846053b5766a1cb

Contents?: true

Size: 418 Bytes

Versions: 57

Compression:

Stored size: 418 Bytes

Contents

module Torch
  module Optim
    module LRScheduler
      class StepLR < LRScheduler
        def initialize(optimizer, step_size:, gamma: 0.1, last_epoch: -1)
          @step_size = step_size
          @gamma = gamma
          super(optimizer, last_epoch)
        end

        def get_lr
          @base_lrs.map { |base_lr| base_lr * @gamma ** (@last_epoch / @step_size).floor }
        end
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
torch-rb-0.9.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.9.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.8.3 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.8.2 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.8.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.8.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.7.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.6.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.5.3 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.5.2 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.5.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.5.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.4.2 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.4.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.4.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.3.7 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.3.6 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.3.5 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.3.4 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.3.3 lib/torch/optim/lr_scheduler/step_lr.rb