code: def test_forward(test, reduce, dtype):
      device = torch.device("cuda:1")
      src = tensor(test["src"], dtype, device)
      index = tensor(test["index"], torch.long, device)
      indptr = tensor(test["indptr"], torch.long, device)
      dim = test["dim"]
      expected = tensor(test[reduce], dtype, device)
  
      out = torch_scatter.scatter(src, index, dim, reduce=reduce)
      assert torch.all(out == expected)
  
      out = torch_scatter.segment_coo(src, index, reduce=reduce)
      assert torch.all(out == expected)
  
      out = torch_scatter.segment_csr(src, indptr, reduce=reduce)
      assert torch.all(out == expected)
  
imports: from itertools import product
  import pytest
  import torch
  import torch_scatter
  from torch_scatter.testing import dtypes, reductions, tensor
label_desc: Use image node_id 1 for calling a global function with example usage: test_forward(test, reduce, dtype) without return types