code: def _fast_rcnn_loc_loss(pred_loc, gt_loc, gt_label, sigma):
      xp = chainer.backends.cuda.get_array_module(pred_loc)
  
      in_weight = xp.zeros_like(gt_loc)
      # Localization loss is calculated only for positive rois.
      in_weight[gt_label > 0] = 1
      loc_loss = _smooth_l1_loss(pred_loc, gt_loc, in_weight, sigma)
      # Normalize by total number of negtive and positive rois.
      loc_loss /= xp.sum(gt_label >= 0)
      return loc_loss
  
file_path: chainercv/chainercv/links/model/faster_rcnn/faster_rcnn_train_chain.py
imports: import numpy
  import chainer
  from chainer.backends import cuda
  import chainer.functions
  from chainercv.links.model.faster_rcnn.utils.anchor_target_creator import AnchorTargetCreator
  from chainercv.links.model.faster_rcnn.utils.proposal_target_creator import ProposalTargetCreator
label_desc: Use image node_id 2 for calling a global function with example usage: _fast_rcnn_loc_loss(pred_loc, gt_loc, gt_label, sigma) and returns: loc_loss