code: def test_allreduce_torch_numpy(ray_start_single_node, backend):
      # import torch
      world_size = 2
      actors, _ = create_collective_workers(world_size, backend=backend)
      ray.wait(
          [
              actors[1].set_buffer.remote(
                  torch.ones(
                      10,
                  )
              )
          ]
      )
      results = ray.get([a.do_allreduce.remote() for a in actors])
      assert (results[0] == np.ones((10,)) * world_size).all()
  
      ray.wait(
          [
              actors[0].set_buffer.remote(
                  torch.ones(
                      10,
                  )
              )
          ]
      )
      ray.wait(
          [actors[1].set_buffer.remote(np.ones(10, dtype=np.float32))]
      )
      ray.get([a.do_allreduce.remote() for a in actors])
  
file_path: ray/python/ray/util/collective/tests/single_node_cpu_tests/test_allreduce.py
imports: import numpy
  import pytest
  import ray
  import torch
  from ray.util.collective.tests.cpu_util import create_collective_workers
  from ray.util.collective.types import Backend, ReduceOp
label_desc: Use image node_id 7 for calling a global function with example usage: test_allreduce_torch_numpy(ray_start_single_node, backend) without return types