class_docstr: Logs the number of paramaters, forward pass FLOPs and activations of the model.
  Adapted from: https://github.com/facebookresearch/ClassyVision/blob/main/classy_vision/hooks/model_complexity_hook.py#L20    # NOQA
class_docstr_tok: ["Logs","the","number","of","paramaters",",","forward","pass","FLOPs","and","activations","of","the","model",".","Adapted","from",":","https",":","\/\/github.com\/facebookresearch\/ClassyVision\/blob\/main\/classy_vision\/hooks\/model_complexity_hook.py","#","L20","#","NOQA"]
docstr: Before the training starts, run one forward only pass of the model on the
  dummy input of shape specified by user in HOOKS.MODEL_COMPLEXITY.INPUT_SHAPE
  We calculate the flops, activations and number of params in the model.
docstr_tok: ["Before","the","training","starts",",","run","one","forward","only","pass","of","the","model","on","the","dummy","input","of","shape","specified","by","user","in","HOOKS.MODEL_COMPLEXITY.INPUT_SHAPE","We","calculate","the","flops",",","activations","and","number","of","params","in","the","model","."]
code: def on_start(self, task) -> None:
      """
      Before the training starts, run one forward only pass of the model on the
      dummy input of shape specified by user in HOOKS.MODEL_COMPLEXITY.INPUT_SHAPE
      We calculate the flops, activations and number of params in the model.
      """
      self.num_flops, self.num_activations, self.num_parameters = (
          0,
          0,
          0,
      )
      input_shape = task.config["HOOKS"]["MODEL_COMPLEXITY"][
          "INPUT_SHAPE"
      ]
      try:
          self.num_parameters = count_params(task.base_model)
          self.num_parameters = round(
              float(self.num_parameters) / 1000000, 4
          )
          try:
              self.num_flops = compute_flops(
                  task.base_model, input_shape
              )
              if self.num_flops is None:
                  logging.info("FLOPs for forward pass: skipped.")
              self.num_flops = round(
                  float(self.num_flops) / 1000000000, 4
              )
          except NotImplementedError:
              logging.warning(
                  "Unsupported modules found in model. FLOPs calculation skipped "
              )
              logging.debug("Exception: ", exc_info=True)
          try:
              self.num_activations = compute_activations(
                  task.base_model, input_shape
              )
              self.num_activations = round(
                  float(self.num_activations) / 1000000, 4
              )
          except NotImplementedError:
              logging.info(
                  "input_shape not found. Skipping activation calculation."
              )
          logging.info(
              f"#params (10^6): {self.num_parameters} "
              f"#FLOPs (10^9): {self.num_flops} "
              f"#activations (10^6): {self.num_activations}"
          )
      except Exception:
          logging.exception(
              "Unexpected failure estimating model complexity."
          )
  
imports: import logging
  import time
  import torch
  from classy_vision import tasks
  from classy_vision.generic.profiler import compute_activations, compute_flops, count_params
  from classy_vision.hooks.classy_hook import ClassyHook
  from fvcore.common.file_io import PathManager
  from vissl.data import AirstoreDataset, GenericSSLDataset
  from vissl.models.model_helpers import model_output_has_nan
  from vissl.utils.env import get_machine_local_and_dist_rank
label_desc: Use image node_id 1 for calling the SSLModelComplexityHook obj's underlying member method code with example usage: obj.on_start(task) without return types