code: def __call__(self, a, b, out=None):
      from ..base import broadcast_to
  
      if a.ndim == 0 or b.ndim == 0:
          raise ValueError(
              "Scalar operands are not allowed, use '*' instead"
          )
      if out is not None and not isinstance(out, Tensor):
          raise TypeError(
              f"out must be a Tensor, got {type(out)} instead"
          )
  
      a_is_1d = False
      if a.ndim == 1:
          a_is_1d = True
          a = a[np.newaxis, :]
  
      b_is_1d = False
      if b.ndim == 1:
          b_is_1d = True
          b = b[:, np.newaxis]
  
      if a.ndim < b.ndim:
          a = a[(b.ndim - a.ndim) * (np.newaxis,)]
      elif a.ndim > b.ndim:
          b = b[(a.ndim - b.ndim) * (np.newaxis,)]
  
      if a.shape[-1] != b.shape[-2]:
          raise ValueError(
              f"shape {a.shape} and {b.shape} not aligned: "
              f"{a.shape[-1]} (dim {a.ndim - 1}) != {b.shape[-2]} (dim {b.ndim - 2})"
          )
  
      shape = broadcast_shape(a.shape[:-2], b.shape[:-2]) + (
          a.shape[-2],
          b.shape[-1],
      )
      order = self._calc_order(a, b, out)
      t = self.new_tensor([a, b], shape, order=order)
  
      if a_is_1d:
          t = t[..., 0, :]
      if b_is_1d:
          t = t[..., 0]
  
      if out is not None:
          check_out_param(out, t, self._casting)
          t = broadcast_to(t, out.shape)
          out.data = t.data
          return out
  
      return t
  
imports: import itertools
  import numpy
  from ...None import opcodes
  from ...serialization.serializables import KeyField, StringField
  from ...utils import has_unknown_shape
  from ..core import Tensor, TensorOrder
  from ..utils import broadcast_shape, check_out_param, unify_chunks, check_order
  from ..array_utils import device, as_same_device, is_sparse_module
  from ..operands import TensorOperand, TensorOperandMixin
  from ..arithmetic.utils import chunk_tree_add
  from ..datasource import tensor
label_desc: Use image node_id 8 for calling the TensorMatmul obj's underlying member method code with example usage: obj.__call__(a, b, out) and returns: t, out