dpnp.linalg.tensorinv
- dpnp.linalg.tensorinv(a, ind=2)[source]
Compute the 'inverse' of an N-dimensional array.
For full documentation refer to
numpy.linalg.tensorinv
.- Parameters:
a ({dpnp.ndarray, usm_ndarray}) -- 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:
2
.
- Returns:
out -- The inverse of a tensor whose shape is equivalent to
a.shape[ind:] + a.shape[:ind]
.- Return type:
dpnp.ndarray
See also
dpnp.linalg.tensordot
Compute tensor dot product along specified axes.
dpnp.linalg.tensorsolve
Solve the tensor equation
a x = b
for x.
Examples
>>> import dpnp as np >>> a = np.eye(4*6) >>> a.shape = (4, 6, 8, 3) >>> ainv = np.linalg.tensorinv(a, ind=2) >>> ainv.shape (8, 3, 4, 6)
>>> a = np.eye(4*6) >>> a.shape = (24, 8, 3) >>> ainv = np.linalg.tensorinv(a, ind=1) >>> ainv.shape (8, 3, 24)