class_docstr: The BaseDataScheduler is the abstract scheduler class specifically for the
  BaseDataSparsifier class. This class controls a specific hyperparameter of
  the sparsifier class and varies it across the training process (or across time).
  
  Args:
      data_sparsifier (instance of BaseDataSparsifier)
          Implemented class data sparsifier class wherein the update_mask is implemented
      schedule_param (str)
          A specific hyperparameter of the passed sparsifier that needs to be scheduled/varied
      last_epoch (int, default=-1)
          This is specifically is passed when training needs to be resumed from a particular
          point.
      verbose (bool, default=False)
          Verbosity of the BaseDataScheduler
  
  The *get_hyperparam()* function needs to be implemented by the user.
class_docstr_tok: ["The","BaseDataScheduler","is","the","abstract","scheduler","class","specifically","for","the","BaseDataSparsifier","class",".","This","class","controls","a","specific","hyperparameter","of","the","sparsifier","class","and","varies","it","across","the","training","process","(","or","across","time",")",".","Args",":","data_sparsifier","(","instance","of","BaseDataSparsifier",")","Implemented","class","data","sparsifier","class","wherein","the","update_mask","is","implemented","schedule_param","(","str",")","A","specific","hyperparameter","of","the","passed","sparsifier","that","needs","to","be","scheduled\/varied","last_epoch","(","int",",","default=-1",")","This","is","specifically","is","passed","when","training","needs","to","be","resumed","from","a","particular","point",".","verbose","(","bool",",","default=False",")","Verbosity","of","the","BaseDataScheduler","The","*","get_hyperparam","(",")","*","function","needs","to","be","implemented","by","the","user","."]
code: def step(self):
      # Raise warning if trying to call scheduler step before the sparsifier.
      # https://github.com/pytorch/pytorch/issues/20124
      if self._step_count == 1:
          if not hasattr(self.data_sparsifier.step, "_with_counter"):
              warnings.warn(
                  "Seems like `data_sparsifier.step()` has been overridden after sparsity scheduler "
                  "initialization. Please, make sure to call `data_sparsifier.step()` before "
                  "`scheduler.step()`.",
                  UserWarning,
              )
  
          # Just check if there were two first scheduler.step() calls before sparsifier.step()
          elif self.data_sparsifier._step_count < 1:  # type: ignore[attr-defined]
              warnings.warn(
                  "Detected call of `scheduler.step()` before `data_sparsifier.step()`. "
                  "You have to make sure you run the data_sparsifier.step() BEFORE any "
                  "calls to the scheduler.step().",
                  UserWarning,
              )
      self._step_count += 1
  
      class _enable_get_sp_call:
          def __init__(self, o):
              self.o = o
  
          def __enter__(self):
              self.o._get_sp_called_within_step = True
              return self
  
          def __exit__(self, type, value, traceback):
              self.o._get_sp_called_within_step = False
  
      with _enable_get_sp_call(self):
          self.last_epoch += 1
          updated_scheduler_params = self.get_schedule_param()
  
      for name, param in updated_scheduler_params.items():
          self.data_sparsifier.data_groups[name][
              self.schedule_param
          ] = param
          if self.verbose:
              print(
                  f"Adjusting {self.schedule_param} for group {name} to {param}"
              )
  
      self._last_param = {
          name: config.get(self.schedule_param, None)
          for name, config in self.data_sparsifier.data_groups.items()
      }
      self.data_sparsifier.enable_mask_update = True
  
file_path: pytorch/torch/ao/pruning/_experimental/data_scheduler/base_data_scheduler.py
imports: from functools import wraps
  import weakref
  import abc
  import warnings
  from ..data_sparsifier import BaseDataSparsifier
label_desc: Use image node_id 7 for calling the BaseDataScheduler obj's underlying member method code with example usage: obj.step() and returns: self