From e79033e52d630ace291897a08346d11fb6db259f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=B2=9C=EA=B5=90/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 21 Oct 2019 16:57:56 +0900 Subject: [PATCH] [loco] Type and shape inference for DepthwiseFilterDecode (#8349) This commit introduces type and shape inference for DepthwiseFilterDecode Signed-off-by: Cheongyo Bahk --- compiler/loco/src/Service/CanonicalShapeInferenceRule.cpp | 7 +++++++ compiler/loco/src/Service/TypeInference.cpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/compiler/loco/src/Service/CanonicalShapeInferenceRule.cpp b/compiler/loco/src/Service/CanonicalShapeInferenceRule.cpp index 947ee04..9ad888f 100644 --- a/compiler/loco/src/Service/CanonicalShapeInferenceRule.cpp +++ b/compiler/loco/src/Service/CanonicalShapeInferenceRule.cpp @@ -363,6 +363,13 @@ public: return loco::NodeShape{node->encoder()->shape(input_tensor_shape)}; } + // CASE: DepthwiseFilterDecode + loco::NodeShape visit(const loco::DepthwiseFilterDecode *node) final + { + auto input_dw_filter_shape = node_shape(node->input()).as(); + return loco::NodeShape{node->decoder()->shape(input_dw_filter_shape)}; + } + // CASE: EltwiseAdd loco::NodeShape visit(const loco::EltwiseAdd *node) final { diff --git a/compiler/loco/src/Service/TypeInference.cpp b/compiler/loco/src/Service/TypeInference.cpp index 0bc4f6b..82c082d 100644 --- a/compiler/loco/src/Service/TypeInference.cpp +++ b/compiler/loco/src/Service/TypeInference.cpp @@ -126,6 +126,10 @@ struct CanonicalTypeForwardAlgorithm final : public loco::CanonicalNodeVisitorinput()); } + loco::DataType visit(const loco::DepthwiseFilterDecode *node) + { + return loco::dtype_get(node->input()); + } loco::DataType visit(const loco::EltwiseAdd *node) { return loco::dtype_get(node->lhs()); } loco::DataType visit(const loco::EltwiseDiv *node) { return loco::dtype_get(node->lhs()); } loco::DataType visit(const loco::EltwiseMul *node) { return loco::dtype_get(node->lhs()); } -- 2.7.4