Template Function sequant::opt::detail::map_leaf_objects

Function Documentation

template<typename Visitor>
ExprPtr sequant::opt::detail::map_leaf_objects(const ExprPtr &leaf, Visitor &&visitor)

Invokes visitor on every Tensor and Variable that is (or is the base of) the terminal expression leaf. If visitor returns a non-null ExprPtr

, it replaces the visited object.

An adjoint-marked tensor is visited in its bare (non-adjoint) form and the replacement is adjointed again.

Returns:

The (potentially new) expression representing leaf