code: def test_CosineWarmupScheduler(self) -> None:
      model = nn.Linear(10, 1)
      optimizer = torch.optim.SGD(
          model.parameters(), lr=1.0, momentum=0.0, weight_decay=0.0
      )
      scheduler = CosineWarmupScheduler(
          optimizer,
          warmup_epochs=3,
          max_epochs=6,
          verbose=True,
          end_value=0.0,
      )
  
      # warmup
      self.assertAlmostEqual(scheduler.get_last_lr()[0], 0.333333333)
      scheduler.step()
      optimizer.step()
      self.assertAlmostEqual(scheduler.get_last_lr()[0], 0.666666666)
      scheduler.step()
      optimizer.step()
      self.assertAlmostEqual(scheduler.get_last_lr()[0], 1.0)
      scheduler.step()
      optimizer.step()
  
      # cosine decay
      self.assertAlmostEqual(scheduler.get_last_lr()[0], 1.0)
      scheduler.step()
      optimizer.step()
      self.assertAlmostEqual(scheduler.get_last_lr()[0], 0.5)
      scheduler.step()
      optimizer.step()
      self.assertAlmostEqual(scheduler.get_last_lr()[0], 0.0)
  
      # extra step for Pytorch Lightning
      scheduler.step()
      optimizer.step()
      self.assertAlmostEqual(scheduler.get_last_lr()[0], 0.0)
  
      # step > max_epochs
      with self.assertWarns(
          RuntimeWarning,
          msg="Current step number 7 exceeds max_steps 6.",
      ):
          scheduler.step()
  
file_path: lightly/tests/utils/test_scheduler.py
imports: import unittest
  import torch
  from torch import nn
  from lightly.utils.scheduler import CosineWarmupScheduler, cosine_schedule
label_desc: Use image node_id 3 for calling the TestScheduler obj's underlying member method code with example usage: obj.test_CosineWarmupScheduler() without return types