mir::Graph mir_graph;
mir::Shape input_shape = mir::Shape({5, 6, 7, 8});
- auto *input = mir_graph.create<mir::ops::InputOp>("input", input_shape);
- mir_graph.create<mir::ops::OutputOp>("output", input->getOutput(0));
+ auto *input = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(input);
+ input->setName("x");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Graph mir_graph;
mir::Shape input_shape = mir::Shape({7, 7, 9, 9});
- auto *input = mir_graph.create<mir::ops::InputOp>("input", input_shape);
- auto *relu = mir_graph.create<mir::ops::ReluOp>("relu", input->getOutput(0));
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", relu->getOutput(0));
+ auto *input = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *relu = mir_graph.create<mir::ops::ReluOp>(input)->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(relu);
+ input->setName("x");
+ relu->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Graph mir_graph;
mir::Shape input_shape = mir::Shape({7, 7, 9, 9});
- auto *input = mir_graph.create<mir::ops::InputOp>("input", input_shape);
- auto *pool = mir_graph.create<mir::ops::PoolOp>(
- "pool", input->getOutput(0), mir::ops::PoolOp::PoolingType::AVG, mir::Shape{2, 3},
- mir::Shape{4, 5}, std::vector<int32_t>{5, 9}, std::vector<int32_t>{7, 4},
- mir::ops::PoolOp::BorderType::EMPTY);
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", pool->getOutput(0));
+ auto *input = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *pool = mir_graph
+ .create<mir::ops::PoolOp>(
+ input, mir::ops::PoolOp::PoolingType::AVG, mir::Shape{2, 3},
+ mir::Shape{4, 5}, std::vector<std::int32_t>{5, 9},
+ std::vector<std::int32_t>{7, 4}, mir::ops::PoolOp::BorderType::EMPTY)
+ ->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(pool);
+ input->setName("x");
+ pool->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Graph mir_graph;
mir::Shape input_shape = mir::Shape({7, 7, 9, 9});
- auto *input = mir_graph.create<mir::ops::InputOp>("input", input_shape);
- auto *pool = mir_graph.create<mir::ops::PoolOp>(
- "pool", input->getOutput(0), mir::ops::PoolOp::PoolingType::MAX, mir::Shape{2, 3},
- mir::Shape{4, 5}, std::vector<int32_t>{5, 9}, std::vector<int32_t>{7, 4},
- mir::ops::PoolOp::BorderType::EMPTY);
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", pool->getOutput(0));
+ auto *input = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *pool = mir_graph
+ .create<mir::ops::PoolOp>(
+ input, mir::ops::PoolOp::PoolingType::MAX, mir::Shape{2, 3},
+ mir::Shape{4, 5}, std::vector<std::int32_t>{5, 9},
+ std::vector<std::int32_t>{7, 4}, mir::ops::PoolOp::BorderType::EMPTY)
+ ->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(pool);
+ input->setName("x");
+ pool->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Graph mir_graph;
mir::Shape input_shape{5, 6, 7, 3};
- auto *input1 = mir_graph.create<mir::ops::InputOp>("input1", input_shape);
- auto *input2 = mir_graph.create<mir::ops::InputOp>("input2", input_shape);
- auto *input3 = mir_graph.create<mir::ops::InputOp>("input3", input_shape);
- std::vector<mir::Operation::Output *> inputs{input1->getOutput(0), input2->getOutput(0),
- input3->getOutput(0)};
- auto *concat = mir_graph.create<mir::ops::ConcatOp>("concat", inputs, 2);
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", concat->getOutput(0));
+ auto *input1 = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *input2 = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *input3 = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ std::vector<mir::Operation::Output *> inputs{input1, input2, input3};
+ auto *concat = mir_graph.create<mir::ops::ConcatOp>(inputs, 2)->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(concat);
+ input1->setName("x1");
+ input2->setName("x2");
+ input3->setName("x3");
+ concat->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
{
mir::Graph mir_graph;
- auto *input = mir_graph.create<mir::ops::InputOp>("input", mir::Shape{7, 8, 9, 9});
- auto *reshape =
- mir_graph.create<mir::ops::ReshapeOp>("reshape", input->getOutput(0), mir::Shape{7, 8, 81});
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", reshape->getOutput(0));
+ auto *input = mir_graph.create<mir::ops::InputOp>(mir::Shape{7, 8, 9, 9})->getOutput(0);
+ auto *reshape = mir_graph.create<mir::ops::ReshapeOp>(input, mir::Shape{7, 8, 81})->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(reshape);
+ input->setName("x");
+ reshape->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Shape shape = mir::Shape({2, 3});
const float data[] = {5.9, 6.7, 5.32, 54.11231, 43.2444, 3.409};
auto mir_tensor = mir::TensorVariant(mir::DataType::FLOAT32, shape, (const void *)data);
- auto *constant = mir_graph.create<mir::ops::ConstantOp>("constant", mir_tensor);
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", constant->getOutput(0));
+ auto *constant = mir_graph.create<mir::ops::ConstantOp>(mir_tensor)->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(constant);
+ constant->setName("x");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Shape input_shape{5, 6, 7, 3};
- auto *input1 = mir_graph.create<mir::ops::InputOp>("input1", input_shape);
- auto *input2 = mir_graph.create<mir::ops::InputOp>("input2", input_shape);
- auto *add = mir_graph.create<mir::ops::AddOp>("add", input1->getOutput(0), input2->getOutput(0));
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", add->getOutput(0));
+ auto *input1 = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *input2 = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *add = mir_graph.create<mir::ops::AddOp>(input1, input2)->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(add);
+ input1->setName("x1");
+ input2->setName("x2");
+ add->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Graph mir_graph;
mir::Shape input_shape = mir::Shape({7, 7, 9, 1});
- auto *input = mir_graph.create<mir::ops::InputOp>("input", input_shape);
+ auto *input = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
mir::Shape shape = mir::Shape({2, 3, 1, 1});
const float data[] = {5.9, 6.7, 5.32, 54.11231, 43.2444, 3.409};
auto mir_tensor = mir::TensorVariant(mir::DataType::FLOAT32, shape, (const void *)data);
- auto *constant = mir_graph.create<mir::ops::ConstantOp>("constant", mir_tensor);
- auto *conv = mir_graph.create<mir::ops::Conv2DOp>(
- "conv", input->getOutput(0), constant->getOutput(0), mir::Shape{2, 3},
- std::vector<int32_t>{5, 9}, std::vector<int32_t>{7, 4});
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", conv->getOutput(0));
+ auto *constant = mir_graph.create<mir::ops::ConstantOp>(mir_tensor)->getOutput(0);
+ auto *conv = mir_graph
+ .create<mir::ops::Conv2DOp>(input, constant, mir::Shape{2, 3},
+ std::vector<std::int32_t>{5, 9},
+ std::vector<std::int32_t>{7, 4})
+ ->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(conv);
+ input->setName("x");
+ conv->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Graph mir_graph;
mir::Shape input_shape = mir::Shape({7, 7, 1, 9});
- auto *input = mir_graph.create<mir::ops::InputOp>("input", input_shape);
- auto *softmax = mir_graph.create<mir::ops::SoftmaxOp>("relu", input->getOutput(0), 2);
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", softmax->getOutput(0));
+ auto *input = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *softmax = mir_graph.create<mir::ops::SoftmaxOp>(input, 2)->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(softmax);
+ input->setName("x");
+ softmax->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Shape input_shape{5, 6, 7, 3};
- auto *input1 = mir_graph.create<mir::ops::InputOp>("input1", input_shape);
- auto *input2 = mir_graph.create<mir::ops::InputOp>("input2", input_shape);
- auto *add = mir_graph.create<mir::ops::MulOp>("mul", input1->getOutput(0), input2->getOutput(0));
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", add->getOutput(0));
+ auto *input1 = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *input2 = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
+ auto *add = mir_graph.create<mir::ops::MulOp>(input1, input2)->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(add);
+ input1->setName("x1");
+ input2->setName("x2");
+ add->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);
mir::Graph mir_graph;
mir::Shape input_shape = mir::Shape({7, 7, 9, 1});
- auto *input = mir_graph.create<mir::ops::InputOp>("input", input_shape);
+ auto *input = mir_graph.create<mir::ops::InputOp>(input_shape)->getOutput(0);
mir::Shape shape = mir::Shape({2, 3, 1, 1});
const float data[] = {5.9, 6.7, 5.32, 54.11231, 43.2444, 3.409};
auto mir_tensor = mir::TensorVariant(mir::DataType::FLOAT32, shape, (const void *)data);
- auto *constant = mir_graph.create<mir::ops::ConstantOp>("constant", mir_tensor);
- auto *conv = mir_graph.create<mir::ops::DepthwiseConv2DOp>(
- "dwconv", input->getOutput(0), constant->getOutput(0), mir::Shape{2, 3},
- std::vector<int32_t>{5, 9}, std::vector<int32_t>{7, 4});
- auto *output = mir_graph.create<mir::ops::OutputOp>("output", conv->getOutput(0));
+ auto *constant = mir_graph.create<mir::ops::ConstantOp>(mir_tensor)->getOutput(0);
+ auto *conv = mir_graph
+ .create<mir::ops::DepthwiseConv2DOp>(input, constant, mir::Shape{2, 3},
+ std::vector<std::int32_t>{5, 9},
+ std::vector<std::int32_t>{7, 4})
+ ->getOutput(0);
+ mir_graph.create<mir::ops::OutputOp>(conv);
+ input->setName("x");
+ conv->setName("y");
mir2loco::Transformer transformer;
auto loco_graph = transformer.transform(&mir_graph);