code: def q_sample(self, x_start, time, noise=None):
      if noise is None:
          noise = torch.randn_like(x_start)
  
      x_start_shape = x_start.shape
  
      sqrt_alphas_cumprod_t = extract(
          self.sqrt_alphas_cumprod, time, x_start_shape
      )
      sqrt_one_minus_alphas_cumprod_t = extract(
          self.sqrt_one_minus_alphas_cumprod, time, x_start_shape
      )
  
      return (
          sqrt_alphas_cumprod_t * x_start
          + sqrt_one_minus_alphas_cumprod_t * noise
      )
  
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 8 for calling the DynamicDiffusionDetHead obj's underlying member method code with example usage: obj.q_sample(x_start, time, noise) and returns: unknown