code: def get_cost(self, y, t):
      y_loc = y[0]  # (batch, num_preds/class, 4)
      y_conf = y[1]  # (batch, num_preds/class, num_classes)
      priors = y[2]  # Nx4 array  (xmin, ymin, xmax, ymax)
      t_loc = t[
          0
      ]  # (max_boxes*4, batch) max_boxes x 4 [xmin, ymin, xmax, ymax] in pixels
      t_conf = t[1]  # (max_boxes, batch)
      n_gt = t[2]  # (1, barch)
  
      self.num_priors = priors.shape[0]
  
      # for now, transpose the input to the shape expected by this layer
      y_loc = (
          y_loc.get().reshape(-1, 4, self.be.bsz).transpose((2, 0, 1))
      )
      y_conf = y_conf.reshape(-1, self.num_classes, self.be.bsz)
  
      # allocate buffers needed to store intermediate results
      if self.loss is None:
          self.loss = self.be.empty(
              (self.be.bsz * self.num_priors, self.num_classes)
          )
  
      if self.y_conf_dev is None:
          self.y_conf_dev = self.be.empty(self.loss.shape).reshape(
              (self.be.bsz, -1, self.num_classes)
          )
  
      # transpose the results to y_conf_dev (needed for softmax)
      self.be.copy_transpose(y_conf, self.y_conf_dev, axes=(2, 0, 1))
  
      y_conf = self.y_conf_dev.get()
  
      assert y_conf.shape[0] == self.be.bsz
      assert y_conf.shape[1] == priors.shape[0]
      assert y_conf.shape[2] == self.num_classes
  
      assert y_loc.shape[0] == self.be.bsz
      assert y_loc.shape[1] == priors.shape[0]
  
      # layer shape is the output shape of the convolution
      # layer generating the input to the priorbox layer
  
      # get the GT boxes
      gt_boxes = self.gen_gt_boxes(t_loc, t_conf, n_gt)
  
      # get the model box predictions
      loc_data = self.gen_locs(y_loc, priors.shape[0])
  
      # find GT prior boxes matches
      matches = self.find_matches(priors, gt_boxes)
  
      # the conf loss is added to matches
      # sparse take of loss from matching ground truth
      self.get_conf_loss(self.y_conf_dev, matches, gt_boxes)
  
      # negative sampling
      # maybe here we need to move to host?
      (all_neg_inds, num_matches) = self.mine_examples(matches)
  
      self.num_matches = num_matches
      if num_matches > 0:
          (loc_gt_data, loc_pred_data) = self.encodeLocPrediction(
              num_matches, matches, loc_data, gt_boxes, priors
          )
          # get a smooth L1 loss for these two vectors
          # may also need to stor values to bprop
          self.loc_diff_data = loc_pred_data - loc_gt_data
          loc_loss = np.sum(self.smoothL1loss(self.loc_diff_data))
      else:
          self.loc_diff_data = 0.0
          loc_loss = 0.0
  
      self.all_neg_inds = all_neg_inds
      num_conf = num_matches + sum(
          [len(all_neg_inds[bt]) for bt in all_neg_inds]
      )
      if num_conf >= 1:
          # conf_gt is num_conf x 1
          # conf_pred is num_conf x num_classes
          (conf_gt, conf_pred) = self.EncodeConfPrediction(
              num_conf, y_conf, matches, all_neg_inds, gt_boxes
          )
          # conf_gt has the GT labels
          # conf_pred has the probs
          # softmax loss
          self.probs = self.softmax(conf_pred, axis=1)
          self.labels = conf_gt
  
          conf_loss = np.sum(
              -1
              * np.log(
                  np.maximum(
                      EPS,
                      self.probs[
                          range(self.probs.shape[0]), self.labels
                      ],
                  )
              )
          )
      else:
          conf_loss = 0.0
  
      self.matches = matches
      self.norm_ = (
          self.be.bsz * self.num_priors
          if num_matches == -1
          else num_matches
      )
      loss = (self.loc_weight * loc_loss + conf_loss) / self.norm_
  
      self.cost = loss
      return loss
  
imports: from neon import NervanaObject
  import numpy
  from util import util
  from neon.transforms import Softmax
label_desc: Use image node_id 3 for calling the MBoxLoss obj's underlying member method code with example usage: obj.get_cost(y, t) and returns: loss