code: def test_linear_scheduler_cycle_size_two():
      tensor = torch.zeros([1], requires_grad=True)
      optimizer = torch.optim.SGD([tensor], lr=0)
  
      scheduler = LinearCyclicalScheduler(
          optimizer, "lr", 1, 0, cycle_size=2
      )
  
      data = [0] * 10
      max_epochs = 2
      simulated_values = LinearCyclicalScheduler.simulate_values(
          num_events=len(data) * max_epochs,
          param_name="lr",
          start_value=1,
          end_value=0,
          cycle_size=2,
      )
  
      def save_lr(engine):
          lrs.append(optimizer.param_groups[0]["lr"])
  
      trainer = Engine(lambda engine, batch: None)
      trainer.add_event_handler(Events.ITERATION_STARTED, scheduler)
      trainer.add_event_handler(Events.ITERATION_COMPLETED, save_lr)
  
      lrs = []
      trainer.run(data, max_epochs=max_epochs)
      assert lrs == list(
          map(
              pytest.approx,
              [
                  1.0,
                  0.0,
                  1.0,
                  0.0,
                  1.0,
                  0.0,
                  1.0,
                  0.0,
                  1.0,
                  0.0,
                  1.0,
                  0.0,
                  1.0,
                  0.0,
                  1.0,
                  0.0,
                  1.0,
                  0.0,
                  1.0,
                  0.0,
              ],
          )
      )
  
      assert lrs == pytest.approx([v for i, v in simulated_values])
  
imports: from unittest.mock import MagicMock, patch
  import numpy
  import pytest
  import torch
  from torch.optim.lr_scheduler import CosineAnnealingWarmRestarts, ExponentialLR, StepLR
  from ignite.engine import Engine, Events
  from ignite.handlers.param_scheduler import ConcatScheduler, CosineAnnealingScheduler, create_lr_scheduler_with_warmup, LinearCyclicalScheduler, LRScheduler, ParamGroupScheduler, ParamScheduler, PiecewiseLinear, ReduceLROnPlateauScheduler
  from tests.ignite.contrib.handlers import MockFP16DeepSpeedZeroOptimizer
label_desc: Use image node_id 4 for calling a global function with example usage: test_linear_scheduler_cycle_size_two() without return types