code: def test_custom_scheduler():
      engine = Engine(lambda e, b: None)
  
      class LambdaState:
          def __init__(self, initial_value, gamma):
              self.initial_value = initial_value
              self.gamma = gamma
  
          def __call__(self, event_index):
              return self.initial_value * self.gamma ** (
                  event_index % 9
              )
  
      lambda_state_parameter_scheduler = LambdaStateScheduler(
          param_name="custom_scheduled_param",
          lambda_obj=LambdaState(initial_value=10, gamma=0.99),
          create_new=True,
      )
      lambda_state_parameter_scheduler.attach(
          engine, Events.EPOCH_COMPLETED
      )
      engine.run([0] * 8, max_epochs=2)
      torch_testing_assert_close(
          getattr(engine.state, "custom_scheduled_param"),
          LambdaState(initial_value=10, gamma=0.99)(2),
      )
      engine.run([0] * 8, max_epochs=20)
      torch_testing_assert_close(
          getattr(engine.state, "custom_scheduled_param"),
          LambdaState(initial_value=10, gamma=0.99)(20),
      )
  
      state_dict = lambda_state_parameter_scheduler.state_dict()
      lambda_state_parameter_scheduler.load_state_dict(state_dict)
  
imports: import re
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  import torch
  import torch.nn
  from packaging.version import Version
  from ignite.engine import Engine, Events
  from ignite.handlers.state_param_scheduler import ExpStateScheduler, LambdaStateScheduler, MultiStepStateScheduler, PiecewiseLinearStateScheduler, StepStateScheduler
  from bisect import bisect_right
label_desc: Use image node_id 9 for calling a global function with example usage: test_custom_scheduler() and returns: unknown