code: def compute_mrcnn_bbox_loss(
      mrcnn_target_deltas, mrcnn_pred_deltas, target_class_ids
  ):
      """
      :param mrcnn_target_deltas: (n_sampled_rois, (dy, dx, (dz), log(dh), log(dw), (log(dh)))
      :param mrcnn_pred_deltas: (n_sampled_rois, n_classes, (dy, dx, (dz), log(dh), log(dw), (log(dh)))
      :param target_class_ids: (n_sampled_rois)
      :return: loss: torch 1D tensor.
      """
      if 0 not in torch.nonzero(target_class_ids > 0).size():
          positive_roi_ix = torch.nonzero(target_class_ids > 0)[:, 0]
          positive_roi_class_ids = target_class_ids[
              positive_roi_ix
          ].long()
          target_bbox = mrcnn_target_deltas[positive_roi_ix, :].detach()
          pred_bbox = mrcnn_pred_deltas[
              positive_roi_ix, positive_roi_class_ids, :
          ]
          loss = F.smooth_l1_loss(pred_bbox, target_bbox)
      else:
          loss = torch.FloatTensor([0]).cuda()
  
      return loss
  
imports: import utils.model_utils
  import utils.exp_utils
  from cuda_functions.nms_2D.pth_nms import nms_gpu
  from cuda_functions.nms_3D.pth_nms import nms_gpu
  from cuda_functions.roi_align_2D.roi_align.crop_and_resize import CropAndResizeFunction
  from cuda_functions.roi_align_3D.roi_align.crop_and_resize import CropAndResizeFunction
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils
label_desc: Use image node_id 4 for calling a global function with example usage: compute_mrcnn_bbox_loss(mrcnn_target_deltas, mrcnn_pred_deltas, target_class_ids) and returns: loss