code: def test_piecewiselinear(milestones_as_np_int):
      tensor = torch.zeros([1], requires_grad=True)
      optimizer = torch.optim.SGD([tensor], lr=0)
  
      milestones_values = [
          (5, 0.5),
          (15, 1.0),
          (25, 0.0),
          (35, 1.0),
          (40, 0.5),
      ]
      if milestones_as_np_int:
          milestones_values = [
              (np.int64(t), v) for t, v in milestones_values
          ]
  
      scheduler = PiecewiseLinear(
          optimizer, "lr", milestones_values=milestones_values
      )
      state_dict = scheduler.state_dict()
  
      def save_lr(engine):
          lrs.append(optimizer.param_groups[0]["lr"])
  
      trainer = Engine(lambda engine, batch: None)
      trainer.add_event_handler(Events.ITERATION_COMPLETED, scheduler)
      trainer.add_event_handler(Events.ITERATION_COMPLETED, save_lr)
  
      for _ in range(2):
          lrs = []
          trainer.run([0] * 25, max_epochs=2)
  
          assert lrs == list(
              map(
                  pytest.approx,
                  [
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                      0.55,
                      0.6,
                      0.65,
                      0.7,
                      0.75,
                      0.8,
                      0.85,
                      0.9,
                      0.95,
                      1.0,
                      0.9,
                      0.8,
                      0.7,
                      0.6,
                      0.5,
                      0.4,
                      0.3,
                      0.2,
                      0.1,
                      0.0,
                      0.1,
                      0.2,
                      0.3,
                      0.4,
                      0.5,
                      0.6,
                      0.7,
                      0.8,
                      0.9,
                      1.0,
                      0.9,
                      0.8,
                      0.7,
                      0.6,
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                      0.5,
                  ],
              )
          )
          scheduler.load_state_dict(state_dict)
  
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 15 for calling a global function with example usage: test_piecewiselinear(milestones_as_np_int) without return types