class_docstr: Example: ::
  
      >>> from torchbearer import Trial
      >>> from torchbearer.callbacks import StepLR
  
      >>> # Assuming optimizer uses lr = 0.05 for all groups
      >>> # lr = 0.05     if epoch < 30
      >>> # lr = 0.005    if 30 <= epoch < 60
      >>> # lr = 0.0005   if 60 <= epoch < 90
      >>> scheduler = StepLR(step_size=30, gamma=0.1)
      >>> trial = Trial(None, callbacks=[scheduler], metrics=['loss'], verbose=2).for_steps(10).run(1)
  
  Args:
      step_on_batch (bool): If True, step will be called on each training iteration rather than on each epoch
  
  See:
      `PyTorch StepLR <http://pytorch.org/docs/master/optim.html#torch.optim.lr_scheduler.StepLR>`_
class_docstr_tok: ["Example",":",":",":",">",">",">","from","torchbearer","import","Trial",">",">",">","from","torchbearer.callbacks","import","StepLR",">",">",">","#","Assuming","optimizer","uses","lr","=","0.05","for","all","groups",">",">",">","#","lr","=","0.05","if","epoch","<","30",">",">",">","#","lr","=","0.005","if","30","<","=","epoch","<","60",">",">",">","#","lr","=","0.0005","if","60","<","=","epoch","<","90",">",">",">","scheduler","=","StepLR","(","step_size=30",",","gamma=0.1",")",">",">",">","trial","=","Trial","(","None",",","callbacks=","[","scheduler","]",",","metrics=","[","'loss","'","]",",","verbose=2",")",".for_steps","(","10",")",".run","(","1",")","Args",":","step_on_batch","(","bool",")",":","If","True",",","step","will","be","called","on","each","training","iteration","rather","than","on","each","epoch","See",":","`","PyTorch","StepLR","<","http",":","\/\/pytorch.org\/docs\/master\/optim.html","#","torch.optim.lr_scheduler.StepLR",">","`","_"]
code: def __init__(self, step_size, gamma=0.1, step_on_batch=False):
      super(StepLR, self).__init__(
          functools.partial(
              torch.optim.lr_scheduler.StepLR,
              step_size=step_size,
              gamma=gamma,
          ),
          step_on_batch=step_on_batch,
      )
  
imports: import functools
  import warnings
  import torch
  import torchbearer
  from torchbearer.bases import get_metric, _pytorch_version_lt, _pytorch_version_gt
  from torchbearer.callbacks import Callback
label_desc: Use image node_id 1 to create a new StepLR object from inherited base classes: TorchScheduler with example: obj = StepLR(step_size, gamma, step_on_batch)