code: def test_profiler_experimental_tree_cuda_with_stream(self):
      streams = [torch.cuda.Stream() for _ in range(3)]
      results = []
      with torch.profiler.profile(profile_memory=True) as p:
          x = torch.ones((4, 4), device="cuda")
          for stream in streams:
              with torch.cuda.stream(stream):
                  results.append(torch.tanh(x) - x)
      del results
      for s in streams:
          torch.cuda.current_stream().wait_stream(s)
  
      self.assertTreesMatch(
          ProfilerTree.format(p.profiler, 12),
          """\
              aten::ones
                aten::empty
                  [memory]
                aten::fill_
                  cudaLaunchKernel
                    void at::native::vectorized_elementwise_kernel<...>(...)
              aten::tanh
                cudaMalloc
                cudaLaunchKernel
                  void at::native::vectorized_elementwise_kernel<...>(...)
                [memory]
              aten::sub
                cudaLaunchKernel
                  void at::native::vectorized_elementwise_kernel<...>(...)
                [memory]
              [memory]
              aten::tanh
                cudaMalloc
                cudaLaunchKernel
                  void at::native::vectorized_elementwise_kernel<...>(...)
                [memory]
              aten::sub
                cudaLaunchKernel
                  void at::native::vectorized_elementwise_kernel<...>(...)
                [memory]
              [memory]
              aten::tanh
                cudaMalloc
                cudaLaunchKernel
                  void at::native::vectorized_elementwise_kernel<...>(...)
                [memory]
              aten::sub
                cudaLaunchKernel
                  void at::native::vectorized_elementwise_kernel<...>(...)
                [memory]
              [memory]""",
          allow_failure=ALLOW_CUDA_FAILURE,
      )
  
imports: import functools
  import os
  import re
  import textwrap
  import traceback
  import unittest
  import expecttest
  import torch
  from torch._C._profiler import _ExtraFields_PyCall, _ExtraFields_PyCCall
  from torch.testing._internal.common_utils import TestCase, run_tests, IS_WINDOWS, TEST_WITH_CROSSREF, IS_ARM64, skipIfTorchDynamo
  from torch.utils._pytree import tree_map
label_desc: Use image node_id 10 for calling the TestProfilerTree obj's underlying member method code with example usage: obj.test_profiler_experimental_tree_cuda_with_stream() without return types