code: def check_log_prob(self, is_gpu):
      smp = self.sample_for_test()
      if is_gpu:
          log_prob1 = self.gpu_dist.log_prob(cuda.to_gpu(smp)).data
      else:
          log_prob1 = self.cpu_dist.log_prob(smp).data
  
      scipy_prob = self.scipy_dist.logpmf
  
      onebyone_smp = smp.reshape(
          (
              int(numpy.prod(self.sample_shape)),
              numpy.prod(self.shape),
              int(numpy.prod(self.event_shape)),
          )
      )
      onebyone_smp = numpy.swapaxes(onebyone_smp, 0, 1)
      onebyone_smp = onebyone_smp.reshape(
          (-1,) + self.sample_shape + self.event_shape
      )
  
      log_prob2 = []
      for one_params, one_smp in zip(
          self.scipy_onebyone_params_iter(), onebyone_smp
      ):
          one_smp = numpy.eye(3)[one_smp]
          log_prob2.append(scipy_prob(one_smp, **one_params))
      log_prob2 = numpy.vstack(log_prob2)
      log_prob2 = log_prob2.reshape(numpy.prod(self.shape), -1).T
      log_prob2 = log_prob2.reshape(self.sample_shape + self.shape)
      array.assert_allclose(log_prob1, log_prob2)
  
file_path: chainer/tests/chainer_tests/distributions_tests/test_categorical.py
imports: import numpy
  from chainer import cuda
  from chainer import distributions
  from chainer import testing
  from chainer.testing import array
label_desc: Use image node_id 4 for calling the TestCategorical obj's underlying member method code with example usage: obj.check_log_prob(is_gpu) without return types