class_docstr: Hook for writing the losses, learning rates and meters to `tensorboard <https
  ://www.tensorflow.org/tensorboard`>_.
  
  Global steps are counted in terms of the number of samples processed.
class_docstr_tok: ["Hook","for","writing","the","losses",",","learning","rates","and","meters","to","`","tensorboard","<","https",":","\/\/www.tensorflow.org\/tensorboard","`",">","_",".","Global","steps","are","counted","in","terms","of","the","number","of","samples","processed","."]
docstr: Initialize losses and learning_rates.
docstr_tok: ["Initialize","losses","and","learning_rates","."]
code: def on_phase_start(self, task) -> None:
      """Initialize losses and learning_rates."""
      self.learning_rates = []
      self.wall_times = []
      self.sample_fetch_times = []
  
      if not is_primary():
          return
  
      if torch.cuda.is_available():
          torch.cuda.reset_max_memory_allocated()
  
      # log the parameters before training starts
      if task.train and task.train_phase_idx == 0:
          for name, parameter in task.base_model.named_parameters():
              self.tb_writer.add_histogram(
                  f"Parameters/{name}", parameter, global_step=-1
              )
  
file_path: ClassyVision/classy_vision/hooks/tensorboard_plot_hook.py
imports: import logging
  import time
  from itertools import accumulate
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from classy_vision.generic.distributed_util import all_reduce_max, is_primary
  from classy_vision.hooks import register_hook
  from classy_vision.hooks.classy_hook import ClassyHook
label_desc: Use image node_id 4 for calling the TensorboardPlotHook obj's underlying member method code with example usage: obj.on_phase_start(task) without return types