code: def _check_bbox_head_loss_pre(self, xp):
      rois = [
          xp.array(((4, 1, 6, 3),), dtype=np.float32),
          xp.array(((0, 1, 2, 3), (5, 4, 10, 6)), dtype=np.float32),
          xp.array(((10, 4, 12, 10),), dtype=np.float32),
      ]
      roi_indices = [
          xp.array((0,), dtype=np.int32),
          xp.array((1, 0), dtype=np.int32),
          xp.array((1,), dtype=np.int32),
      ]
  
      bboxes = [
          xp.array(((2, 4, 6, 7), (1, 12, 3, 30)), dtype=np.float32),
          xp.array(((10, 2, 12, 12),), dtype=np.float32),
      ]
      labels = [
          xp.array((10, 4), dtype=np.float32),
          xp.array((1,), dtype=np.float32),
      ]
      rois, roi_indices, gt_locs, gt_labels = bbox_head_loss_pre(
          rois, roi_indices, (0.1, 0.2), bboxes, labels
      )
  
      self.assertEqual(len(rois), 3)
      self.assertEqual(len(roi_indices), 3)
      self.assertEqual(len(gt_locs), 3)
      self.assertEqual(len(gt_labels), 3)
      for l in range(3):
          self.assertIsInstance(rois[l], xp.ndarray)
          self.assertIsInstance(roi_indices[l], xp.ndarray)
          self.assertIsInstance(gt_locs[l], xp.ndarray)
          self.assertIsInstance(gt_labels[l], xp.ndarray)
  
          self.assertEqual(rois[l].shape[0], roi_indices[l].shape[0])
          self.assertEqual(rois[l].shape[0], gt_locs[l].shape[0])
          self.assertEqual(rois[l].shape[0], gt_labels[l].shape[0])
          self.assertEqual(rois[l].shape[1:], (4,))
          self.assertEqual(roi_indices[l].shape[1:], ())
          self.assertEqual(gt_locs[l].shape[1:], (4,))
          self.assertEqual(gt_labels[l].shape[1:], ())
  
imports: from __future__ import division
  import numpy
  import unittest
  import chainer
  from chainer import testing
  from chainer.testing import attr
  from chainercv.links.model.fpn import bbox_head_loss_post
  from chainercv.links.model.fpn import bbox_head_loss_pre
  from chainercv.links.model.fpn import BboxHead
label_desc: Use image node_id 1 for calling the TestBboxLoss obj's underlying member method code with example usage: obj._check_bbox_head_loss_pre(xp) without return types