docstr: (Maybe) performs a single optimization step.
docstr_tok: ["(","Maybe",")","performs","a","single","optimization","step","."]
code: def step(self):
      """(Maybe) performs a single optimization step."""
      self.update_sample_statistics()
      if self.accumulated_steps < self.min_sample_guard:
          rule_check = False
      else:
          if self.accumulated_steps > self.max_sample_guard:
              rule_check = True
          else:
              if self.progress_rule == "norm-based":
                  rule_check = self.norm_test()
              elif self.progress_rule == "inner-product":
                  rule_check = self.inner_product_test()
              elif self.progress_rule == "cov":
                  rule_check = self.coefficient_of_variation()
              elif self.progress_rule == "cosine":
                  rule_check = self.cosine_test()
              else:
                  raise ValueError(
                      f"Invalid progress rules {self.progress_rule} given."
                  )
  
      if rule_check:
          self.copy_mean_grad()  # reference running mean in p.grad attributes
          if self.monotone:
              self.min_sample_guard = (
                  self.accumulated_steps
              )  # raise lower limit if forcing monotone batch sizes
          self.reset_sample_statistics()  # reset running mean
          super().step()
      else:
          # otherwise defer the step and accumulate more gradients
          pass
  
file_path: bert-ultrafast/training/cramming/backend/optimizers/progressive_batching.py
imports: import torch
  from collections import defaultdict
  from .optimizer_modifiers import MetaOptimizer
  import logging
label_desc: Use image node_id 2 for calling the ProgressiveBatching obj's underlying member method code with example usage: obj.step() without return types