class_docstr: Tests Distribution classes.
class_docstr_tok: ["Tests","Distribution","classes","."]
code: def test_determinstic(self):
      batch_size = 128
      ndim = 4
      sample_shape = 100000
  
      loc = np.random.randn(batch_size, ndim)
  
      loc_tens = torch.from_numpy(loc).float()
  
      dist = TorchDeterministic(loc=loc_tens)
      sample = dist.sample(sample_shape=(sample_shape,))
      sample2 = dist.sample(sample_shape=(sample_shape,))
      check(sample, sample2)
  
      # check shape of samples
      self.assertEqual(sample.shape, (sample_shape, batch_size, ndim))
      self.assertEqual(sample.dtype, torch.float32)
      # check that none of the samples are nan
      self.assertFalse(torch.isnan(sample).any())
  
file_path: ray/rllib/models/tests/test_distributions.py
imports: from copy import copy
  import numpy
  import unittest
  import math
  from ray.rllib.models.torch.torch_distributions import TorchCategorical, TorchDiagGaussian, TorchDeterministic
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.numpy import softmax, SMALL_NUMBER, LARGE_INTEGER
  from ray.rllib.utils.test_utils import check
label_desc: Use image node_id 4 for calling the TestDistributions obj's underlying member method code with example usage: obj.test_determinstic() without return types