code: def test_sample(self):
      # check shape
      sample_action = self.dist.sample()
      self.assertEqual(
          list(sample_action.shape),
          [
              self.batch_size,
          ],
      )
      # range check
      self.assertGreaterEqual(torch.max(sample_action), 0)
      self.assertLess(torch.min(sample_action), self.num_actions)
  
      # construct a logit to output determined class
      fool_logits = torch.zeros(
          size=(self.batch_size, self.num_actions)
      )
      fool_logits[:, 0] = 9999999999
      set_random_seed(12)
      sample_action = self.get_dist(fool_logits).sample()
      self.assertTrue(self.torch_check_eq(sample_action, 0))
  
imports: import random
  import copy
  import numpy
  import torch
  import unittest
  from parl.core.torch.policy_distribution import DiagGaussianDistribution, CategoricalDistribution, SoftCategoricalDistribution, SoftMultiCategoricalDistribution
label_desc: Use image node_id 4 for calling the CategoricalDistributionTest obj's underlying member method code with example usage: obj.test_sample() without return types