class_docstr: Single training iteration loop of the model.
  
  Performs: data read, forward, loss computation, backward, optimizer step, parameter updates.
  
  Various intermediate steps are also performed:
  - logging the training loss, training eta, LR, etc to loggers
  - logging to tensorboard,
  - performing any self-supervised method specific operations (like in MoCo approach, the
  momentum encoder is updated), computing the scores in swav
  - checkpointing model if user wants to checkpoint in the middle
  of an epoch
code: def log_sub_losses(task: ClassyTask, sub_losses: Dict[str, Any]):
      for loss_key, loss_val in sub_losses.items():
          # If provided with a tensor, we assume that this is a local value
          # and perform the step to compute its mean across workers
          if isinstance(loss_val, torch.Tensor):
              loss_val = all_reduce_mean(
                  loss_val.detach().clone()
              ).item()
              task.additional_log_data[f"loss.{loss_key}"] = loss_val
          # Else, if provided with a scalar, we assume it has already
          # been computed appropriately
          elif isinstance(loss_val, (int, float)):
              task.additional_log_data[f"loss.{loss_key}"] = loss_val
  
imports: import contextlib
  from types import SimpleNamespace
  from typing import Any, Dict
  import torch
  from classy_vision.generic.distributed_util import all_reduce_mean
  from classy_vision.tasks import ClassyTask
  from classy_vision.tasks.classification_task import AmpType
  from vissl.hooks import SSLClassyHookFunctions
  from vissl.trainer.train_steps import register_train_step
  from vissl.utils.activation_checkpointing import manual_gradient_all_reduce, manual_sync_params
  from vissl.utils.fsdp_utils import is_fsdp_model
  from vissl.utils.misc import is_apex_available, torch_version
  from vissl.utils.perf_stats import PerfTimer
  from vissl.utils.profiler import record_function
label_desc: Use image node_id 6 for calling the StandardTrainStep obj's underlying member method code with example usage: obj.log_sub_losses(task, sub_losses) without return types