[mir] Make getInput the same as getInputProducer (#8236)
authorSergei Barannikov/Engineer/AI Tools Lab /SRR/Samsung Electronics <s.barannikov@samsung.com>
Wed, 16 Oct 2019 13:28:25 +0000 (16:28 +0300)
committerAlexander Efimov/./AI Tools Lab/Samsung Electronics <a.efimov@samsung.com>
Wed, 16 Oct 2019 13:28:25 +0000 (16:28 +0300)
Make `getInput` the same as `getInputProducer`. The latter will be removed.

Signed-off-by: Sergei Barannikov <s.barannikov@samsung.com>
compiler/mir/include/mir/Operation.h
compiler/mir/unittests/Operation.cpp

index 18db323..4e55577 100644 (file)
@@ -159,24 +159,26 @@ public:
   std::deque<Output> &getOutputs() { return _outputs; }
   const std::deque<Output> &getOutputs() const { return _outputs; }
 
-  Input *getInput(std::size_t index)
+  Output *getInput(std::size_t index)
   {
     assert(index < _inputs.size());
-    return &_inputs[index];
+    return _inputs[index].getProducer();
   }
 
-  const Input *getInput(std::size_t index) const
+  const Output *getInput(std::size_t index) const
   {
     assert(index < _inputs.size());
-    return &_inputs[index];
+    return _inputs[index].getProducer();
   }
 
+  // TODO Remove after replacing uses with `getInput`.
   Output *getInputProducer(std::size_t index)
   {
     assert(index < _inputs.size());
     return _inputs[index].getProducer();
   }
 
+  // TODO Remove after replacing uses with `getInput`.
   const Output *getInputProducer(std::size_t index) const
   {
     assert(index < _inputs.size());
@@ -195,10 +197,7 @@ public:
     return &_outputs[index];
   }
 
-  const Shape &getInputShape(std::size_t index) const
-  {
-    return getInputProducer(index)->getShape();
-  }
+  const Shape &getInputShape(std::size_t index) const { return getInput(index)->getShape(); }
 
   const Shape &getOutputShape(std::size_t index) const { return getOutput(index)->getShape(); }
 
index 0ebcad6..8eed5cf 100644 (file)
@@ -32,7 +32,7 @@ TEST(Operation, ConnectionTest)
   auto op2 = new ops::ReshapeOp(op1->getOutput(0), Shape{});
   op2->setId(1);
 
-  ASSERT_EQ(op1, op2->getInputProducer(0)->getNode());
+  ASSERT_EQ(op1, op2->getInput(0)->getNode());
 
   delete op1;
   delete op2;