code: def compute_bbox_loss(target_deltas, pred_deltas, anchor_matches):
      """
      :param target_deltas:   (b, n_positive_anchors, (dy, dx, (dz), log(dh), log(dw), (log(dd)))).
      Uses 0 padding to fill in unsed bbox deltas.
      :param pred_deltas: predicted deltas from bbox regression head. (b, n_anchors, (dy, dx, (dz), log(dh), log(dw), (log(dd))))
      :param anchor_matches: (n_anchors). [-1, 0, class_id] for negative, neutral, and positive matched anchors.
      :return: loss: torch 1D tensor.
      """
      if 0 not in torch.nonzero(anchor_matches > 0).size():
          indices = torch.nonzero(anchor_matches > 0).squeeze(1)
          # Pick bbox deltas that contribute to the loss
          pred_deltas = pred_deltas[indices]
          # Trim target bounding box deltas to the same length as pred_deltas.
          target_deltas = target_deltas[: pred_deltas.size()[0], :]
          # Smooth L1 loss
          loss = F.smooth_l1_loss(pred_deltas, target_deltas)
      else:
          loss = torch.FloatTensor([0]).cuda()
  
      return loss
  
imports: import utils.model_utils
  import utils.exp_utils
  import sys
  from cuda_functions.nms_2D.pth_nms import nms_gpu
  from cuda_functions.nms_3D.pth_nms import nms_gpu
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils
label_desc: Use image node_id 2 for calling a global function with example usage: compute_bbox_loss(target_deltas, pred_deltas, anchor_matches) and returns: loss