Fix return value in einsum_path for simple contractions (#3232)

Co-authored-by: KD2YCU <[email protected]>
Co-authored-by: Angelos Katharopoulos <[email protected]>
This commit is contained in:
Dan Anderson
2026-03-09 21:48:26 -07:00
committed by GitHub
co-authored by KD2YCU Angelos Katharopoulos
parent a25399cbd4
commit 9bbd375eec
+3 -1
View File
@@ -800,7 +800,7 @@ std::pair<std::vector<PathNode>, PathInfo> einsum_path_helper(
max_size = std::max(max_size, term_size(in, dim_map));
}
PathInfo path_info;
PathInfo path_info{};
// Get the full naive cost
std::tie(path_info.naive_cost, path_info.naive_scaling) =
@@ -813,6 +813,8 @@ std::pair<std::vector<PathNode>, PathInfo> einsum_path_helper(
std::iota(positions.begin(), positions.end(), 0);
path.emplace_back(
std::move(inputs), std::move(output), std::move(positions));
path_info.optimized_cost = path_info.naive_cost;
path_info.optimized_scaling = path_info.naive_scaling;
} else {
std::tie(path, path_info.optimized_cost, path_info.optimized_scaling) =
greedy_path(inputs, output, dim_map, path_info.naive_cost, max_size);