code: def update(self, labels, preds):
      if self.pred_idx >= 0 and self.label_idx >= 0:
          pred = preds[self.pred_idx]
          label = preds[self.label_idx]
      else:
          pred = preds[self.pred.index("rpn_cls_prob")]
          label = labels[self.label.index("rpn_label")]
          # label = preds[self.pred.index('rpn_label')]
  
      # label (b, p)
      label = label.asnumpy().astype("int32").reshape((-1))
      # pred (b, c, p) or (b, c, h, w) --> (b, p, c) --> (b*p, c)
      pred = (
          pred.asnumpy()
          .reshape((pred.shape[0], pred.shape[1], -1))
          .transpose((0, 2, 1))
      )
      pred = pred.reshape((label.shape[0], -1))
  
      # filter with keep_inds
      keep_inds = np.where(label != -1)[0]
      label = label[keep_inds]
      cls = pred[keep_inds, label]
      # print('in_metric log', label.shape, cls.shape, file=sys.stderr)
  
      cls += 1e-14
      cls_loss = -1 * np.log(cls)
      cls_loss = np.sum(cls_loss)
      self.sum_metric += cls_loss
      self.num_inst += label.shape[0]
  
imports: from __future__ import print_function
  import sys
  import mxnet
  import numpy
  from rcnn.config import config
label_desc: Use image node_id 2 for calling the RPNLogLossMetric obj's underlying member method code with example usage: obj.update(labels, preds) without return types