You are viewing an older version (2.4.3).Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / _core / einsumfunc / _parse_possible_contraction

function

numpy._core.einsumfunc:_parse_possible_contraction

source: /numpy/_core/einsumfunc.py:224

Signature

def _parse_possible_contraction(positions, input_sets, output_set, idx_dict, memory_limit, path_cost, naive_cost)

Summary

Compute the cost (removed size + flops) and resultant indices for performing the contraction specified by positions.

Parameters

positions : tuple of int

The locations of the proposed tensors to contract.

input_sets : list of sets

The indices found on each tensors.

output_set : set

The output indices of the expression.

idx_dict : dict

Mapping of each index to its size.

memory_limit : int

The total allowed size for an intermediary tensor.

path_cost : int

The contraction cost so far.

naive_cost : int

The cost of the unoptimized expression.

Returns

cost : (int, int)

A tuple containing the size of any indices removed, and the flop cost.

positions : tuple of int

The locations of the proposed tensors to contract.

new_input_sets : list of sets

The resulting new list of indices if this proposed contraction is performed.

Aliases

  • numpy._core.einsumfunc._parse_possible_contraction