code: def test_matmul():
      a_data = [[1, 0], [0, 1]]
      b_data = [[4, 1], [2, 2]]
  
      a = tensor(a_data, chunk_size=1)
      b = tensor(b_data, chunk_size=1)
  
      t = matmul(a, b)
  
      assert t.shape == (2, 2)
      t = tile(t)
      assert t.shape == tuple(sum(s) for s in t.nsplits)
  
      b_data = [1, 2]
      b = tensor(b_data, chunk_size=1)
  
      t = matmul(a, b)
  
      assert t.shape == (2,)
      t = tile(t)
      assert t.shape == tuple(sum(s) for s in t.nsplits)
  
      t = matmul(b, a)
  
      assert t.shape == (2,)
      t = tile(t)
      assert t.shape == tuple(sum(s) for s in t.nsplits)
  
      a_data = np.arange(2 * 2 * 4).reshape((2, 2, 4))
      b_data = np.arange(2 * 2 * 4).reshape((2, 4, 2))
  
      a = tensor(a_data, chunk_size=1)
      b = tensor(b_data, chunk_size=1)
  
      t = matmul(a, b)
  
      assert t.shape == (2, 2, 2)
      t = tile(t)
      assert t.shape == tuple(sum(s) for s in t.nsplits)
  
      t = matmul(
          tensor([2j, 3j], chunk_size=1), tensor([2j, 3j], chunk_size=1)
      )
  
      assert t.shape == ()
      t = tile(t)
      assert t.shape == tuple(sum(s) for s in t.nsplits)
  
      with pytest.raises(ValueError):
          matmul([1, 2], 3)
  
      with pytest.raises(ValueError):
          matmul(np.random.randn(2, 3, 4), np.random.randn(3, 4, 3))
  
      t = matmul(
          tensor(np.random.randn(2, 3, 4), chunk_size=2),
          tensor(np.random.randn(3, 1, 4, 3), chunk_size=3),
      )
      assert t.shape == (3, 2, 3, 3)
  
      v = ones((100, 100), chunk_size=10)
      tv = matmul(v, v)
      assert tv.shape == (100, 100)
      tv = tile(tv)
      assert tv.shape == tuple(sum(s) for s in tv.nsplits)
  
imports: import numpy
  import pytest
  import scipy.sparse
  from ....core import enter_mode, tile
  from ...datasource import array, ones, tensor, empty
  from ...fetch import TensorFetch
  from ...linalg import matmul
  from ...core import Tensor, SparseTensor
  from ..None import add, subtract, truediv, log, frexp, around, isclose, isfinite, negative, cos, tree_add, tree_multiply, TensorAdd, TensorTreeAdd, TensorTreeMultiply, TensorSubtract, TensorLog, TensorIsclose, TensorGreaterThan
label_desc: Use image node_id 20 for calling a global function with example usage: test_matmul() without return types