Template Function sequant::opt::single_term_opt

Function Documentation

template<ObjectiveFunction Metric = ObjectiveFunction::DenseFLOPs, has_index_extent IdxToSz>
ExprPtr sequant::opt::single_term_opt(Product const &prod, IdxToSz &&idxsz, bool subnet_cse = false, CostParams const &cost = {}, container::vector<NodeBatchAnnotation> *out_axes = nullptr)

Note

prod is assumed to consist of only Tensor expressions

Note

The remaining parameters (subnet_cse, cost) are forwarded verbatim to the detail single_term_opt overload; see it for their semantics. All batching config (contracted/external role predicates, batch_target_size, inner_pow, batch_persistent_only) lives on CostParams.

Template Parameters:

Metric – Objective function (DenseFLOPs by default; DenseSize minimizes total operand storage rather than flops; DenseSpaceTime minimizes peak memory over the evaluation schedule &#8212; see ObjectiveFunction).

Parameters:
  • prodProduct to be optimized.

  • idxsz – An invocable object that maps an Index object to size.

  • out_axes – When non-null and Metric == ObjectiveFunction::DenseSpaceTimeBatched, filled with the per-node sliced-sets of the returned Product tree’s contraction nodes, in the same left-first post-order the nested Product below is built in (so (*out_axes)[j] annotates the j-th Product node formed by the -1-handling arm of the loop below). Left empty if prod has fewer than 3 factors (no factorization is performed) or if Metric != DenseSpaceTimeBatched.

Returns:

Parenthesized product expression.