22#include <gtest/gtest.h>
31TEST(OptPass, eliminateTransposesLinear)
57 ASSERT_EQ(
"i_0.t_1.r_4.", ss.str());
60TEST(OptPass, combineTransposesLinear)
85 ASSERT_EQ(
"i_0.t_4.r_3.", ss.str());
86 Operation::Use use =
g.getInputs()[0]->getOutput(0)->getUses()[0];
87 auto ax_ord_actual =
dynamic_cast<ops::TransposeOp *
>(use.getNode())->getAxisOrder();
88 auto ax_ord_true = vector<size_t>{1, 2, 0};
89 ASSERT_TRUE(ax_ord_actual == ax_ord_true);
92TEST(OptPass, combineTransposesBush)
110 std::stringstream ss;
115 ASSERT_EQ(
"i_0.b_4.", ss.str());
116 ASSERT_EQ(elw->getInput(0)->getNode()->getType(), mir::Operation::Type::input);
117 ASSERT_EQ(elw->getInput(1)->getNode()->getType(), mir::Operation::Type::input);
120TEST(OptPass, combineTransposesOpOrder)
141 int n1 = in1->getId();
142 int n2 = in2->getId();
145 ASSERT_EQ(
g.getOutputs()[0]->getInput(0)->getNode()->getType(), mir::Operation::Type::add);
147 ASSERT_EQ(n1, elw->getInput(0)->getNode()->getId());
148 ASSERT_EQ(n2, elw->getInput(1)->getNode()->getId());
Tensor transpose operation.
This pass combines sequential transposes and removes identity transposes if the combination results i...
PassData run(PassData data) override
run compiler pass