code: def test_reducescatter_torch_cupy(
      ray_start_distributed_multigpu_2_nodes_4_gpus,
  ):
      world_size = 2
      num_gpu_per_worker = 2
      actual_world_size = world_size * num_gpu_per_worker
      shape = [10, 10]
      actors, _ = create_collective_multigpu_workers(world_size)
  
      # tensor is pytorch, list is cupy
      for i, a in enumerate(actors):
          ray.get(
              [
                  a.set_buffer.remote(
                      shape, tensor_type0="torch", tensor_type1="torch"
                  )
              ]
          )
          ray.get(
              [
                  a.set_list_buffer.remote(
                      shape, tensor_type0="cupy", tensor_type1="cupy"
                  )
              ]
          )
      results = ray.get(
          [a.do_reducescatter_multigpu.remote() for a in actors]
      )
      for i in range(world_size):
          for j in range(num_gpu_per_worker):
              assert (
                  results[i][j]
                  == torch.ones(shape, dtype=torch.float32).cuda(j)
                  * actual_world_size
              ).all()
  
      # tensor is cupy, list is pytorch
      for i, a in enumerate(actors):
          ray.get(
              [
                  a.set_buffer.remote(
                      shape, tensor_type0="cupy", tensor_type1="cupy"
                  )
              ]
          )
          ray.get(
              [
                  a.set_list_buffer.remote(
                      shape, tensor_type0="torch", tensor_type1="torch"
                  )
              ]
          )
      results = ray.get(
          [a.do_reducescatter_multigpu.remote() for a in actors]
      )
      for i in range(world_size):
          for j in range(num_gpu_per_worker):
              assert (
                  results[i][j]
                  == cp.ones(shape, dtype=cp.float32)
                  * actual_world_size
              ).all()
  
imports: import pytest
  import ray
  import cupy
  import torch
  from ray.util.collective.tests.util import create_collective_multigpu_workers, init_tensors_for_gather_scatter_multigpu
label_desc: Use image node_id 2 for calling a global function with example usage: test_reducescatter_torch_cupy(ray_start_distributed_multigpu_2_nodes_4_gpus) without return types