code: def test_values(self):
      # check system default flags
      set_determinism(None)
      self.assertTrue(not torch.backends.cudnn.deterministic)
      self.assertTrue(get_seed() is None)
      # set default seed
      set_determinism()
      self.assertTrue(get_seed() is not None)
      self.assertTrue(torch.backends.cudnn.deterministic)
      self.assertTrue(not torch.backends.cudnn.benchmark)
      # resume default
      set_determinism(None)
      self.assertTrue(not torch.backends.cudnn.deterministic)
      self.assertTrue(not torch.backends.cudnn.benchmark)
      self.assertTrue(get_seed() is None)
      # test seeds
      seed = 255
      set_determinism(seed=seed)
      self.assertEqual(seed, get_seed())
      a = np.random.randint(seed)
      b = torch.randint(seed, (1,))
      # tset when global flag support is disabled
      torch.backends.disable_global_flags()
      set_determinism(seed=seed)
      c = np.random.randint(seed)
      d = torch.randint(seed, (1,))
      self.assertEqual(a, c)
      self.assertEqual(b, d)
      self.assertTrue(torch.backends.cudnn.deterministic)
      self.assertTrue(not torch.backends.cudnn.benchmark)
      set_determinism(seed=None)
  
file_path: MONAI/tests/test_set_determinism.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from monai.utils import get_seed, set_determinism
  from tests.utils import SkipIfBeforePyTorchVersion, skip_if_no_cuda
label_desc: Use image node_id 1 for calling the TestSetDeterminism obj's underlying member method code with example usage: obj.test_values() without return types