code: def test_non_contiguous(test, dtype, device):
      src = tensor(test["src"], dtype, device)
      index = tensor(test["index"], torch.long, device)
      indptr = tensor(test["indptr"], torch.long, device)
      expected = tensor(test["expected"], dtype, device)
  
      if src.dim() > 1:
          src = src.transpose(0, 1).contiguous().transpose(0, 1)
      if index.dim() > 1:
          index = index.transpose(0, 1).contiguous().transpose(0, 1)
      if indptr.dim() > 1:
          indptr = indptr.transpose(0, 1).contiguous().transpose(0, 1)
  
      out = gather_csr(src, indptr)
      assert torch.all(out == expected)
  
      out = gather_coo(src, index)
      assert torch.all(out == expected)
  
file_path: pytorch_scatter/test/test_gather.py
imports: from itertools import product
  import pytest
  import torch
  from torch.autograd import gradcheck
  from torch_scatter import gather_coo, gather_csr
  from torch_scatter.testing import devices, dtypes, tensor
label_desc: Use image node_id 4 for calling a global function with example usage: test_non_contiguous(test, dtype, device) without return types