code: def cosine_beta_schedule(timesteps, s=0.008):
      """Cosine schedule as proposed in
      https://openreview.net/forum?id=-NEXDKk8gZ."""
      steps = timesteps + 1
      x = torch.linspace(0, timesteps, steps, dtype=torch.float64)
      alphas_cumprod = (
          torch.cos(((x / timesteps) + s) / (1 + s) * math.pi * 0.5)
          ** 2
      )
      alphas_cumprod = alphas_cumprod / alphas_cumprod[0]
      betas = 1 - (alphas_cumprod[1:] / alphas_cumprod[:-1])
      return torch.clip(betas, 0, 0.999)
  
imports: import copy
  import math
  import random
  import warnings
  from typing import Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import build_activation_layer
  from mmcv.ops import batched_nms
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox2roi, bbox_cxcywh_to_xyxy, bbox_xyxy_to_cxcywh, get_box_wh, scale_boxes
  from mmdet.utils import InstanceList
label_desc: Use image node_id 1 for calling a global function with example usage: cosine_beta_schedule(timesteps, s) and returns: torch