# cupy.linalg.tensorinv¶

cupy.linalg.tensorinv(a, ind=2)[source]

Computes the inverse of a tensor.

This function computes tensor a_inv from tensor a such that tensordot(a_inv, a, ind) == I, where I denotes the identity tensor.

Parameters
• a (cupy.ndarray) – The tensor such that prod(a.shape[:ind]) == prod(a.shape[ind:]).

• ind (int) – The positive number used in axes option of tensordot.

Returns

The inverse of a tensor whose shape is equivalent to a.shape[ind:] + a.shape[:ind].

Return type

cupy.ndarray

Warning

This function calls one or more cuSOLVER routine(s) which may yield invalid results if input conditions are not met. To detect these invalid results, you can set the linalg configuration to a value that is not ignore in cupyx.errstate() or cupyx.seterr().