code: def test_broadcasting(reduce, device):
      B, C, H, W = (4, 3, 8, 8)
  
      src = torch.randn((B, C, H, W), device=device)
      index = torch.randint(0, H, (H,)).to(device, torch.long)
      out = scatter(src, index, dim=2, dim_size=H, reduce=reduce)
      assert out.size() == (B, C, H, W)
  
      src = torch.randn((B, C, H, W), device=device)
      index = torch.randint(0, H, (B, 1, H, W)).to(device, torch.long)
      out = scatter(src, index, dim=2, dim_size=H, reduce=reduce)
      assert out.size() == (B, C, H, W)
  
      src = torch.randn((B, C, H, W), device=device)
      index = torch.randint(0, H, (H,)).to(device, torch.long)
      out = scatter(src, index, dim=2, dim_size=H, reduce=reduce)
      assert out.size() == (B, C, H, W)
  
imports: from itertools import product
  import pytest
  import torch
  from torch_scatter import scatter
  from torch_scatter.testing import devices, reductions
label_desc: Use image node_id 1 for calling a global function with example usage: test_broadcasting(reduce, device) without return types