Class: Torch::Optim::LRScheduler::ExponentialLR
- Inherits:
-
LRScheduler
- Object
- LRScheduler
- Torch::Optim::LRScheduler::ExponentialLR
- Defined in:
- lib/torch/optim/lr_scheduler/exponential_lr.rb
Instance Method Summary collapse
- #get_lr ⇒ Object
-
#initialize(optimizer, gamma, last_epoch: -1)) ⇒ ExponentialLR
constructor
A new instance of ExponentialLR.
Methods inherited from LRScheduler
Constructor Details
#initialize(optimizer, gamma, last_epoch: -1)) ⇒ ExponentialLR
Returns a new instance of ExponentialLR.
5 6 7 8 |
# File 'lib/torch/optim/lr_scheduler/exponential_lr.rb', line 5 def initialize(optimizer, gamma, last_epoch: -1) @gamma = gamma super(optimizer, last_epoch) end |
Instance Method Details
#get_lr ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/torch/optim/lr_scheduler/exponential_lr.rb', line 10 def get_lr if @last_epoch == 0 @base_lrs else @optimizer.param_groups.map do |group| group[:lr] * @gamma end end end |