Commit c0bab0a6 authored by Paul's avatar Paul
Browse files

Use replace_if

parent dec385e9
......@@ -1546,9 +1546,9 @@ struct onnx_parser
literal s = parse_value(attr);
s.visit([&](auto v) { copy(v, std::back_inserter(result)); });
// Clamp large indices to -1
for(auto&& x : result)
if(x > int64_t{std::numeric_limits<std::int32_t>::max()} / 2)
x = -1;
std::replace_if(result.begin(), result.end(), [](auto x) {
return x > int64_t{std::numeric_limits<std::int32_t>::max()} / 2;
}, -1);
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