* [loco] Revise shape inference condition
This will add condition to ShapeInference to infer when target node shape is unknown and input(s) shape is ready
Signed-off-by: SaeHie Park <saehie.park@samsung.com>
* remove print code
#include <stdex/Memory.h>
+namespace
+{
+
+bool inputs_shape_ready(loco::Node *node)
+{
+ assert(node != nullptr);
+
+ for (uint32_t arity = 0; arity < node->arity(); ++arity)
+ {
+ if (!loco::ShapeInference::known(node->arg(arity)))
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+} // namespace
+
//
// Infrastructure
//
{
loco::NodeShape shape;
- if (_rule->infer(node, shape))
+ if (!shape_known(node) && inputs_shape_ready(node))
{
- node->annot(stdex::make_unique<ShapeAnnotation>(shape));
- changed = true;
+ if (_rule->infer(node, shape))
+ {
+ node->annot(stdex::make_unique<ShapeAnnotation>(shape));
+ changed = true;
+ }
}
}
}