code: def tensorinv(a, ind=2):
      r"""
      Compute the 'inverse' of an N-dimensional array.
  
      The result is an inverse for `a` relative to the tensordot operation
      ``tensordot(a, b, ind)``, i. e., up to floating-point accuracy,
      ``tensordot(tensorinv(a), a, ind)`` is the "identity" tensor for the
      tensordot operation.
  
      Parameters
      ----------
      a : array_like
          Tensor to 'invert'. Its shape must be 'square', i. e.,
          ``prod(a.shape[:ind]) == prod(a.shape[ind:])``.
      ind : int, optional
          Number of first indices that are involved in the inverse sum.
          Must be a positive integer, default is 2.
  
      Returns
      -------
      b : ndarray
          `a`'s tensordot inverse, shape ``a.shape[ind:] + a.shape[:ind]``.
  
      Raises
      ------
      MXNetError
          If `a` is singular or not 'square' (in the above sense).
  
      See Also
      --------
      tensordot, tensorsolve
  
      Examples
      --------
      >>> a = np.eye(4*6)
      >>> a.shape = (4, 6, 8, 3)
      >>> ainv = np.linalg.tensorinv(a, ind=2)
      >>> ainv.shape
      (8, 3, 4, 6)
      >>> b = np.random.randn(4, 6)
      >>> np.allclose(np.tensordot(ainv, b), np.linalg.tensorsolve(a, b))
      True
  
      >>> a = np.eye(4*6)
      >>> a.shape = (24, 8, 3)
      >>> ainv = np.linalg.tensorinv(a, ind=1)
      >>> ainv.shape
      (8, 3, 24)
      >>> b = np.random.randn(24)
      >>> np.allclose(np.tensordot(ainv, b, 1), np.linalg.tensorsolve(a, b))
      True
      """
      return _api_internal.tensorinv(a, ind)
  
file_path: mxnet/python/mxnet/ndarray/numpy/linalg.py
imports: import numpy
  from .None import _op
  from .None import _api_internal
label_desc: Use image node_id 12 for calling a global function with example usage: tensorinv(a, ind) and returns: _api_internal