cuquantum.einsum_path(subscripts, *operands, optimize=True)[source]

A drop-in replacement of numpy.einsum_path() for evaluating the “best” contraction order using cuTensorNet.

Only a subset of the NumPy options is supported using this interface. The contract_path() 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.

  • 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, and torch.Tensor.

  • optimize – This parameter specifies options for path optimization. The only value allowed with this interface is True.


A 2-tuple (path, opt_info):

  • pathA list starting with the string ‘einsum_path’ and followed by a sequence of pairs of operand ordinals

    representing the best contraction order in the numpy.einsum_path() format.

  • opt_infoString representation of an object of type OptimizerInfo containing information about

    the best contraction order.

Return type