cuquantum.einsum¶
- cuquantum.einsum(subscripts, *operands, out=None, dtype=None, order='K', casting='safe', optimize=True)[source]¶
A drop-in replacement of
numpy.einsum()
for computing the specified tensor contraction using cuTensorNet.Not all NumPy options are supported or even used. The
contract()
function provides an extensive set of options specific to cuTensorNet and is recommended over this function.Explicit as well as implicit form is supported for the Einstein summation expression. In addition to the subscript format, the interleaved format is also supported as a means of specifying the operands and their mode labels. See
Network
for more detail on the types of operands as well as for examples.- Parameters
subscripts – The mode labels (subscripts) defining the Einstein summation expression as a comma-separated sequence of characters. Unicode characters are allowed in the expression thereby expanding the size of the tensor network that can be specified using the Einstein summation convention.
operands – A sequence of tensors (ndarray-like objects). The currently supported types are
numpy.ndarray
,cupy.ndarray
, andtorch.Tensor
.out – Not supported in this release.
dtype – Not supported in this release.
order – Not supported in this release.
casting – Not supported in this release.
optimize – This parameter specifies options for path optimization. The only values accepted by this interface are
True
,False
, or the contraction path specified in thenumpy.einsum_path()
format.
- Returns
A tensor (ndarray-like object) of the same type and on the same device as the operands containing the result of the contraction.
- Return type
output
Note
For PyTorch operands, calling this method is not tracked by the autograd graph.