From 6ea8780886187e0ae32bb7ffee0b77161e1c4d2a Mon Sep 17 00:00:00 2001 From: Edward Chen <18449977+edgchen1@users.noreply.github.com> Date: Thu, 22 Sep 2022 09:30:22 -0700 Subject: [PATCH] Replace std::exclusive_scan() with for loop because std::exclusive_scan() is not implemented in GCC 7. (#13045) --- onnxruntime/core/framework/kernel_registry.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/framework/kernel_registry.cc b/onnxruntime/core/framework/kernel_registry.cc index 24f11a6a8c..2b314999a7 100644 --- a/onnxruntime/core/framework/kernel_registry.cc +++ b/onnxruntime/core/framework/kernel_registry.cc @@ -49,8 +49,14 @@ bool MatchKernelDefTypes(const Node& node, const auto actual_input_arg_offsets = [&actual_input_arg_counts]() { InlinedVector offsets{}; offsets.reserve(actual_input_arg_counts.size()); - std::exclusive_scan(actual_input_arg_counts.begin(), actual_input_arg_counts.end(), - std::back_inserter(offsets), 0); + // std::exclusive_scan() is not supported until GCC 9.3 + // std::exclusive_scan(actual_input_arg_counts.begin(), actual_input_arg_counts.end(), + // std::back_inserter(offsets), 0); + int current_offset = 0; + for (size_t i = 0; i < actual_input_arg_counts.size(); ++i) { + offsets.push_back(current_offset); + current_offset += actual_input_arg_counts[i]; + } return offsets; }();