opt_einsum.paths.PathOptimizer

class opt_einsum.paths.PathOptimizer[source]

Base class for different path optimizers to inherit from.

Subclassed optimizers should define a call method with signature:

def __call__(self, inputs, output, size_dict, memory_limit=None):
    """
    Parameters
    ----------
    inputs : list[set[str]]
        The indices of each input array.
    outputs : set[str]
        The output indices
    size_dict : dict[str, int]
        The size of each index
    memory_limit : int, optional
        If given, the maximum allowed memory.
    """
    # ... compute path here ...
    return path

where path is a list of int-tuples specifiying a contraction order.

__init__()

Initialize self. See help(type(self)) for accurate signature.