class_docstr: A suite of tests for the CUDA API in TorchScript.
class_docstr_tok: ["A","suite","of","tests","for","the","CUDA","API","in","TorchScript","."]
code: def test_stream_args(self):
      # Test stream creation with default arguments
      @torch.jit.script
      def stream_default_args() -> bool:
          s = torch.cuda.Stream()
          return s.device_index() == torch.cuda.current_device()
  
      @torch.jit.script
      def stream_default_args_for_device() -> bool:
          s = torch.cuda.Stream(priority=0)
          return s.device_index() == torch.cuda.current_device()
  
      @torch.jit.script
      def stream_default_args_for_priority() -> bool:
          d = torch.device("cuda:1")
          s = torch.cuda.Stream(d)
          return s.device_index() == 1
  
      @torch.jit.script
      def stream_args_all() -> bool:
          d = torch.device("cuda:0")
          s = torch.cuda.Stream(d, 0)
          return s.device_index() == 0
  
      self.assertTrue(stream_default_args)
      self.assertTrue(stream_default_args_for_device)
      self.assertTrue(stream_default_args_for_priority)
      self.assertTrue(stream_args_all)
  
file_path: pytorch/test/jit/test_cuda.py
imports: import os
  import sys
  import gc
  import unittest
  import torch
  from typing import NamedTuple
  from torch.testing import FileCheck
  from torch.testing._internal.jit_utils import JitTestCase
  from torch.testing._internal.common_utils import skipIfRocm, skipCUDANonDefaultStreamIf, NoTest, TEST_CUDA
  from torch.testing._internal.common_cuda import TEST_MULTIGPU
label_desc: Use image node_id 3 for calling the TestCUDA obj's underlying member method code with example usage: obj.test_stream_args() and returns: unknown, unknown, unknown, unknown