code: def test_allgather_different_array_size(
      ray_start_single_node, array_size, tensor_backend, backend
  ):
      world_size = 2
      actors, _ = create_collective_workers(world_size, backend=backend)
      init_tensors_for_gather_scatter(
          actors, array_size=array_size, tensor_backend=tensor_backend
      )
      results = ray.get([a.do_allgather.remote() for a in actors])
      for i in range(world_size):
          for j in range(world_size):
              if tensor_backend == "numpy":
                  assert (
                      results[i][j]
                      == np.ones(array_size, dtype=np.float32) * (j + 1)
                  ).all()
              else:
                  assert (
                      results[i][j]
                      == torch.ones(array_size, dtype=torch.float32)
                      * (j + 1)
                  ).all()
  
file_path: ray/python/ray/util/collective/tests/single_node_cpu_tests/test_allgather.py
imports: import numpy
  import pytest
  import ray
  import torch
  from ray.util.collective.tests.cpu_util import create_collective_workers, init_tensors_for_gather_scatter
  from ray.util.collective.types import Backend
label_desc: Use image node_id 1 for calling a global function with example usage: test_allgather_different_array_size(ray_start_single_node, array_size, tensor_backend, backend) without return types