code: def test_weights_scalar_handler(dummy_model_factory):
      model = dummy_model_factory(
          with_grads=True, with_frozen_layer=False
      )
  
      # define test wrapper to test with and without optional tag
      def _test(tag=None):
          wrapper = WeightsScalarHandler(model, tag=tag)
          logger = NeptuneLogger(
              project="tests/dry-run",
              mode="debug",
          )
          mock_engine = MagicMock()
          mock_engine.state = State()
          mock_engine.state.epoch = 5
  
          wrapper(mock_engine, logger, Events.EPOCH_STARTED)
  
          tag_prefix = f"{tag}/" if tag else ""
  
          assert_logger_called_once_with(
              logger, tag_prefix + "weights_norm/fc1/weight", 0.0
          )
          assert_logger_called_once_with(
              logger, tag_prefix + "weights_norm/fc1/bias", 0.0
          )
          assert_logger_called_once_with(
              logger, tag_prefix + "weights_norm/fc2/weight", 12.0
          )
          assert_logger_called_once_with(
              logger,
              tag_prefix + "weights_norm/fc2/bias",
              math.sqrt(12.0),
          )
  
          logger.stop()
  
      _test()
      _test(tag="tag")
  
imports: import math
  import warnings
  from unittest.mock import MagicMock
  import pytest
  import torch
  from ignite.contrib.handlers.neptune_logger import global_step_from_engine, GradsScalarHandler, NeptuneLogger, NeptuneSaver, OptimizerParamsHandler, OutputHandler, WeightsScalarHandler
  from ignite.engine import Engine, Events, State
label_desc: Use image node_id 13 for calling a global function with example usage: test_weights_scalar_handler(dummy_model_factory) without return types