code: def _matmul(a, b, transa=False, transb=False, transout=False):
      if transout:
          transa, transb = not transb, not transa
          a, b = b, a
      if transa and a.ndim != 1:
          a = a.swapaxes(-1, -2)
      if transb and b.ndim != 1:
          b = b.swapaxes(-1, -2)
      xp = backend.get_array_module(a)
  
      if hasattr(
          xp, "matmul"
      ):  # numpy.matmul is supported from version 1.10.0
          return xp.matmul(a, b)
      if a.ndim <= 2 or b.ndim <= 2:
          return numpy.dot(a, b)
      else:
          return numpy.einsum("...ij,...jk->...ik", a, b)
  
imports: import warnings
  import numpy
  from chainer import backend
  from chainer.backends import cuda
  from chainer import function_node
  import chainer.functions
  from chainer import utils
  from chainer.utils import type_check
  import chainerx
label_desc: Use image node_id 4 for calling a global function with example usage: _matmul(a, b, transa, transb, transout) and returns: xp, numpy, numpy