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.18.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.17.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.17.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.16.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.15.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.14.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.14.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.13.2 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.13.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.13.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.12.2 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.12.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.12.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.11.2 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.11.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.11.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.10.2 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.10.1 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.10.0 lib/torch/optim/lr_scheduler/step_lr.rb
torch-rb-0.9.2 lib/torch/optim/lr_scheduler/step_lr.rb