code: def dot(tensor1, tensor2, like=None):
      """Returns the matrix or dot product of two tensors.
  
      * If both tensors are 0-dimensional, elementwise multiplication
        is performed and a 0-dimensional scalar returned.
  
      * If both tensors are 1-dimensional, the dot product is returned.
  
      * If the first array is 2-dimensional and the second array 1-dimensional,
        the matrix-vector product is returned.
  
      * If both tensors are 2-dimensional, the matrix product is returned.
  
      * Finally, if the the first array is N-dimensional and the second array
        M-dimensional, a sum product over the last dimension of the first array,
        and the second-to-last dimension of the second array is returned.
  
      Args:
          tensor1 (tensor_like): input tensor
          tensor2 (tensor_like): input tensor
  
      Returns:
          tensor_like: the matrix or dot product of two tensors
      """
      x, y = np.coerce([tensor1, tensor2], like=like)
  
      if like == "torch":
          if x.ndim == 0 and y.ndim == 0:
              return x * y
  
          if x.ndim <= 2 and y.ndim <= 2:
              return x @ y
  
          return np.tensordot(x, y, axes=[[-1], [-2]], like=like)
  
      if like in {"tensorflow", "autograd"}:
          shape_y = len(np.shape(y))
          shape_x = len(np.shape(x))
          if shape_x == 0 and shape_y == 0:
              return x * y
  
          if shape_y == 1:
              return np.tensordot(x, y, axes=[[-1], [0]], like=like)
  
          if shape_x == 2 and shape_y == 2:
              return x @ y
  
          return np.tensordot(x, y, axes=[[-1], [-2]], like=like)
  
      return np.dot(x, y, like=like)
  
imports: import functools
  from collections.abc import Sequence
  import autoray
  import numpy
  from autograd.numpy.numpy_boxes import ArrayBox
  from autoray import numpy
  from numpy import ndarray
  from .None import single_dispatch
  from .utils import cast, cast_like, get_interface, requires_grad
label_desc: Use image node_id 9 for calling a global function with example usage: dot(tensor1, tensor2, like) and returns: np, np, np, unknown, unknown, unknown, np, unknown