class_docstr: Helper handler to log model's weights as scalars.
  Handler iterates over named parameters of the model, applies reduction function to each parameter
  produce a scalar and then logs the scalar.
  
  Args:
      model: model to log weights
      reduction: function to reduce parameters into scalar
      tag: common title for all produced plots. For example, "generator"
      show_legend: flag to show legend in the window
  
  Examples:
      .. code-block:: python
  
          from ignite.contrib.handlers.visdom_logger import *
  
          # Create a logger
          vd_logger = VisdomLogger()
  
          # Attach the logger to the trainer to log model's weights norm after each iteration
          vd_logger.attach(
              trainer,
              event_name=Events.ITERATION_COMPLETED,
              log_handler=WeightsScalarHandler(model, reduction=torch.norm)
          )
code: def __call__(
      self,
      engine: Engine,
      logger: VisdomLogger,
      event_name: Union[str, Events],
  ) -> None:
      if not isinstance(logger, VisdomLogger):
          raise RuntimeError(
              "Handler 'WeightsScalarHandler' works only with VisdomLogger"
          )
  
      global_step = engine.state.get_event_attrib_value(event_name)
      tag_prefix = f"{self.tag}/" if self.tag else ""
      for name, p in self.model.named_parameters():
          name = name.replace(".", "/")
          k = f"{tag_prefix}weights_{self.reduction.__name__}/{name}"
          v = self.reduction(p.data)
          self.add_scalar(logger, k, v, event_name, global_step)
  
      logger._save()
  
imports: import os
  from typing import Any, Callable, cast, Dict, List, Optional, Union
  import torch
  import torch.nn
  from torch.optim import Optimizer
  from ignite.contrib.handlers.base_logger import BaseLogger, BaseOptimizerParamsHandler, BaseOutputHandler, BaseWeightsScalarHandler
  from ignite.engine import Engine, Events
  from ignite.handlers import global_step_from_engine
label_desc: Use image node_id 2 for calling the WeightsScalarHandler obj's underlying member method code with example usage: obj.__call__(engine, logger, event_name) without return types