class_docstr: Update a parameter during training by using a step function.
  This function decays the parameter value by gamma every step_size.
  Based on StepLR from PyTorch.
  https://pytorch.org/docs/stable/generated/torch.optim.lr_scheduler.StepLR.html
  
  Args:
      initial_value: Starting value of the parameter.
      gamma: Multiplicative factor of parameter value decay.
      step_size: Period of parameter value decay.
      param_name: name of parameter to update.
      save_history: whether to log the parameter values to
          `engine.state.param_history`, (default=False).
      create_new: whether to create ``param_name`` on
          ``engine.state`` taking into account whether
          ``param_name`` attribute already exists or not.
          Overrides existing attribute by default, (default=False).
  
  Examples:
  
      .. include:: defaults.rst
          :start-after: :orphan:
  
      .. testcode::
  
          default_trainer = get_default_trainer()
  
          param_scheduler = StepStateScheduler(
              param_name="param", initial_value=1, gamma=0.9, step_size=5, create_new=True
          )
  
          # parameter is param, initial_value sets param to 1, gamma is set as 0.9
          # Epoch 1 to 4, param does not change as step size is 5,
          # Epoch 5, param changes from 1 to 1*0.9, param = 0.9
          # Epoch 5 to 9, param = 0.9 as step size is 5,
          # Epoch 10, param changes from 0.9 to 0.9*0.9, param = 0.81
          # Epoch 10 to 14, param = 0.81, as step size is 5
          # Epoch 15, param changes from 0.81 to 0.81*0.9, param = 0.729
          # and so on ... the param change at Epoch = 5, 10, 15, 20, . . .
  
          param_scheduler.attach(default_trainer, Events.EPOCH_COMPLETED)
  
          @default_trainer.on(Events.EPOCH_COMPLETED(every=5))
          def print_param():
              print(default_trainer.state.param)
  
          default_trainer.run([0], max_epochs=25)
  
      .. testoutput::
  
          0.9
          0.81
          0.7290...
          0.6561
          0.5904...
  
  .. versionadded:: 0.4.7
class_docstr_tok: ["Update","a","parameter","during","training","by","using","a","step","function",".","This","function","decays","the","parameter","value","by","gamma","every","step_size",".","Based","on","StepLR","from","PyTorch",".","https",":","\/\/pytorch.org\/docs\/stable\/generated\/torch.optim.lr_scheduler.StepLR.html","Args",":","initial_value",":","Starting","value","of","the","parameter",".","gamma",":","Multiplicative","factor","of","parameter","value","decay",".","step_size",":","Period","of","parameter","value","decay",".","param_name",":","name","of","parameter","to","update",".","save_history",":","whether","to","log","the","parameter","values","to","`","engine.state.param_history","`",",","(","default=False",")",".","create_new",":","whether","to","create","``","param_name","``","on","``","engine.state","``","taking","into","account","whether","``","param_name","``","attribute","already","exists","or","not",".","Overrides","existing","attribute","by","default",",","(","default=False",")",".","Examples",":","..","include",":",":","defaults.rst",":","start-after",":",":","orphan",":","..","testcode",":",":","default_trainer","=","get_default_trainer","(",")","param_scheduler","=","StepStateScheduler","(","param_name=","''","param","''",",","initial_value=1",",","gamma=0.9",",","step_size=5",",","create_new=True",")","#","parameter","is","param",",","initial_value","sets","param","to","1",",","gamma","is","set","as","0.9","#","Epoch","1","to","4",",","param","does","not","change","as","step","size","is","5",",","#","Epoch","5",",","param","changes","from","1","to","1","*","0.9",",","param","=","0.9","#","Epoch","5","to","9",",","param","=","0.9","as","step","size","is","5",",","#","Epoch","10",",","param","changes","from","0.9","to","0.9","*","0.9",",","param","=","0.81","#","Epoch","10","to","14",",","param","=","0.81",",","as","step","size","is","5","#","Epoch","15",",","param","changes","from","0.81","to","0.81","*","0.9",",","param","=","0.729","#","and","so","on","...","the","param","change","at","Epoch","=","5",",","10",",","15",",","20",",",".",".",".","param_scheduler.attach","(","default_trainer",",","Events.EPOCH_COMPLETED",")","@","default_trainer.on","(","Events.EPOCH_COMPLETED","(","every=5",")",")","def","print_param","(",")",":","print","(","default_trainer.state.param",")","default_trainer.run","(","[","0","]",",","max_epochs=25",")","..","testoutput",":",":","0.9","0.81","0.7290","...","0.6561","0.5904","...","..","versionadded",":",":","0.4.7"]
code: def __init__(
      self,
      initial_value: float,
      gamma: float,
      step_size: int,
      param_name: str,
      save_history: bool = False,
      create_new: bool = False,
  ):
      super(StepStateScheduler, self).__init__(
          param_name, save_history, create_new
      )
      self.initial_value = initial_value
      self.gamma = gamma
      self.step_size = step_size
      self._state_attrs += ["initial_value", "gamma", "step_size"]
  
imports: import numbers
  import warnings
  from bisect import bisect_right
  from typing import Any, List, Sequence, Tuple, Union
  from ignite.engine import CallableEventWithFilter, Engine, Events, EventsList
  from ignite.handlers.param_scheduler import BaseParamScheduler
label_desc: Use image node_id 1 to create a new StepStateScheduler object from inherited base classes: StateParamScheduler with example: obj = StepStateScheduler(initial_value, gamma, step_size, param_name, save_history, create_new)