code: def lr_func_cosine(cfg: LRSchedulerConf, cur_epoch: float) -> float:
      """
      Retrieve the learning rate to specified values at specified epoch with the
      cosine learning rate schedule. Details can be found in:
      Ilya Loshchilov, and  Frank Hutter ,SGDR: Stochastic Gradient
      Descent With Warm Restarts.
  
      Args:
          cfg (CfgNode): Hydra / omega conf object associated with
              Learningrate scheduler. The schema can be found in
              `LRSchedulerConf` and the example configs can be found in
              `pytorchvideo_trainer/conf/module/lr_scheduler`.
          cur_epoch (float): the number of epoch of the current training stage.
      """
      offset = cfg.warmup_iters if cfg.cosine_after_warmup else 0.0
      assert cfg.cosine_end_lr < cfg.lr
      return (
          cfg.cosine_end_lr
          + (cfg.lr - cfg.cosine_end_lr)
          * (
              math.cos(
                  math.pi
                  * (cur_epoch - offset)
                  / (cfg.max_iters - offset)
              )
              + 1.0
          )
          * 0.5
      )
  
file_path: pytorchvideo/pytorchvideo_trainer/pytorchvideo_trainer/module/lr_policy.py
imports: import math
  from dataclasses import dataclass
  from typing import Callable, List
  import torch
  from hydra.core.config_store import ConfigStore
  from omegaconf import MISSING
label_desc: Use image node_id 2 for calling a global function with example usage: lr_func_cosine(cfg, cur_epoch) and returns: unknown