Commit c0bab0a6 authored by Paul's avatar Paul
Browse files

Use replace_if

parent dec385e9
...@@ -1546,9 +1546,9 @@ struct onnx_parser ...@@ -1546,9 +1546,9 @@ struct onnx_parser
literal s = parse_value(attr); literal s = parse_value(attr);
s.visit([&](auto v) { copy(v, std::back_inserter(result)); }); s.visit([&](auto v) { copy(v, std::back_inserter(result)); });
// Clamp large indices to -1 // Clamp large indices to -1
for(auto&& x : result) std::replace_if(result.begin(), result.end(), [](auto x) {
if(x > int64_t{std::numeric_limits<std::int32_t>::max()} / 2) return x > int64_t{std::numeric_limits<std::int32_t>::max()} / 2;
x = -1; }, -1);
return result; return result;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment