code: def check_proposal_target_creator(
      self, bbox, label, roi, proposal_target_creator
  ):
      xp = cuda.get_array_module(roi)
      sample_roi, gt_roi_loc, gt_roi_label = proposal_target_creator(
          roi, bbox, label
      )
  
      # Test types
      self.assertIsInstance(sample_roi, xp.ndarray)
      self.assertIsInstance(gt_roi_loc, xp.ndarray)
      self.assertIsInstance(gt_roi_label, xp.ndarray)
  
      sample_roi = cuda.to_cpu(sample_roi)
      gt_roi_loc = cuda.to_cpu(gt_roi_loc)
      gt_roi_label = cuda.to_cpu(gt_roi_label)
  
      # Test shapes
      n_sample = len(sample_roi)
      if self.n_sample is None:
          self.assertGreaterEqual(self.n_roi + self.n_bbox, n_sample)
      else:
          self.assertGreaterEqual(self.n_sample, n_sample)
      self.assertEqual(sample_roi.shape, (n_sample, 4))
      self.assertEqual(gt_roi_loc.shape, (n_sample, 4))
      self.assertEqual(gt_roi_label.shape, (n_sample,))
  
      # Test foreground and background labels
      np.testing.assert_equal(np.sum(gt_roi_label >= 0), n_sample)
      n_pos = np.sum(gt_roi_label >= 1)
      n_neg = np.sum(gt_roi_label == 0)
      self.assertLessEqual(n_pos, n_sample * self.pos_ratio)
      self.assertLessEqual(n_neg, n_sample - n_pos)
  
file_path: chainercv/tests/links_tests/model_tests/faster_rcnn_tests/utils_tests/test_proposal_target_creator.py
imports: import unittest
  import numpy
  from chainer.backends import cuda
  from chainer import testing
  from chainer.testing import attr
  from chainercv.links.model.faster_rcnn import ProposalTargetCreator
  from chainercv.utils import generate_random_bbox
label_desc: Use image node_id 2 for calling the TestProposalTargetCreator obj's underlying member method code with example usage: obj.check_proposal_target_creator(bbox, label, roi, proposal_target_creator) without return types