class_docstr: Helper handler to log model's weights as scalars.
  Handler, upon construction, iterates over named parameters of the model and keep
  reference to ones permitted by `whitelist`. Then at every call, applies
  reduction function to each parameter, produces a scalar and logs it.
  
  Args:
      model: model to log weights
      reduction: function to reduce parameters into scalar
      tag: common title for all produced plots. For example, "generator"
      whitelist: specific weights to log. Should be list of model's submodules
          or parameters names, or a callable which gets weight along with its name
          and determines if it should be logged. Names should be fully-qualified.
          For more information please refer to `PyTorch docs
          <https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.get_submodule>`_.
          If not given, all of model's weights are logged.
  
  Examples:
      .. code-block:: python
  
          from ignite.contrib.handlers.tensorboard_logger import *
  
          # Create a logger
          tb_logger = TensorboardLogger(log_dir="experiments/tb_logs")
  
          # Attach the logger to the trainer to log model's weights norm after each iteration
          tb_logger.attach(
              trainer,
              event_name=Events.ITERATION_COMPLETED,
              log_handler=WeightsScalarHandler(model, reduction=torch.norm)
          )
  
      .. code-block:: python
  
          from ignite.contrib.handlers.tensorboard_logger import *
  
          tb_logger = TensorboardLogger(log_dir="experiments/tb_logs")
  
          # Log only `fc` weights
          tb_logger.attach(
              trainer,
              event_name=Events.ITERATION_COMPLETED,
              log_handler=WeightsScalarHandler(
                  model,
                  whitelist=['fc']
              )
          )
  
      .. code-block:: python
  
          from ignite.contrib.handlers.tensorboard_logger import *
  
          tb_logger = TensorboardLogger(log_dir="experiments/tb_logs")
  
          # Log weights which have `bias` in their names
          def has_bias_in_name(n, p):
              return 'bias' in n
  
          tb_logger.attach(
              trainer,
              event_name=Events.ITERATION_COMPLETED,
              log_handler=WeightsScalarHandler(model, whitelist=has_bias_in_name)
          )
  
  ..  versionchanged:: 0.4.9
      optional argument `whitelist` added.
code: def __call__(
      self,
      engine: Engine,
      logger: TensorboardLogger,
      event_name: Union[str, Events],
  ) -> None:
      if not isinstance(logger, TensorboardLogger):
          raise RuntimeError(
              "Handler 'WeightsScalarHandler' works only with TensorboardLogger"
          )
  
      global_step = engine.state.get_event_attrib_value(event_name)
      tag_prefix = f"{self.tag}/" if self.tag else ""
      for name, p in self.weights:
          name = name.replace(".", "/")
          logger.writer.add_scalar(
              f"{tag_prefix}weights_{self.reduction.__name__}/{name}",
              self.reduction(p.data),
              global_step,
          )
  
imports: from typing import Any, Callable, List, Optional, Union
  from torch.optim import Optimizer
  from ignite.contrib.handlers.base_logger import BaseLogger, BaseOptimizerParamsHandler, BaseOutputHandler, BaseWeightsHandler, BaseWeightsScalarHandler
  from ignite.engine import Engine, Events
  from ignite.handlers import global_step_from_engine
label_desc: Use image node_id 1 for calling the WeightsScalarHandler obj's underlying member method code with example usage: obj.__call__(engine, logger, event_name) without return types