"ts/webui/package.json" did not exist on "a9711e24a150d2cf4e5cb3ed3d2224789369feda"
auto_contiguous.cpp 519 Bytes
Newer Older
Paul's avatar
Paul committed
1
2
3
4
5
6
7
8
#include <migraph/auto_contiguous.hpp>
#include <migraph/program.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/iterator_for.hpp>

namespace migraph {

Paul's avatar
Paul committed
9
void auto_contiguous::apply(program& p) const
Paul's avatar
Paul committed
10
11
12
13
{
    for(auto ins : iterator_for(p))
    {
        shape s = ins->result;
Paul's avatar
Paul committed
14
        if(not s.standard())
Paul's avatar
Paul committed
15
        {
Paul's avatar
Paul committed
16
            auto c = p.insert_instruction(std::next(ins), contiguous{}, ins);
Paul's avatar
Paul committed
17
            p.replace_instruction(ins, c);
Paul's avatar
Paul committed
18
19
20
21
22
        }
    }
}

} // namespace migraph