"src/targets/cpu/fmod.cpp" did not exist on "0b217041e03162c32c41873cc024401d3ef1caba"
Commit 60fb4cc3 authored by Paul's avatar Paul
Browse files

Preallocate vector

parent b28bd72d
......@@ -10,9 +10,10 @@ void expect_shape(migraph::shape expected, migraph::operation op, Ts... xs)
{
migraph::program p;
std::vector<migraph::shape> shapes{xs...};
std::vector<migraph::instruction_ref> args;
for(auto&& s : shapes)
args.push_back(p.add_outline(s));
std::vector<migraph::instruction_ref> args(shapes.size());
std::transform(shapes.begin(), shapes.end(), args.begin(), [&](auto&& s) {
return p.add_outline(s);
});
p.add_instruction(op, args);
if(p.get_shape() != expected)
{
......@@ -28,9 +29,10 @@ void throws_shape(migraph::operation op, Ts... xs)
{
migraph::program p;
std::vector<migraph::shape> shapes{xs...};
std::vector<migraph::instruction_ref> args;
for(auto&& s : shapes)
args.push_back(p.add_outline(s));
std::vector<migraph::instruction_ref> args(shapes.size());
std::transform(shapes.begin(), shapes.end(), args.begin(), [&](auto&& s) {
return p.add_outline(s);
});
bool thrown = test::throws([&] { p.add_instruction(op, args); });
if(not thrown)
{
......
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