From 47da0c415cb738b0071a37c4d0dd1ea60db13302 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 7 Aug 2019 10:30:01 +0900 Subject: [PATCH] [exo-tflite] BiasShape to ShapeDescription Converter (#6289) This commit implements BiasShape -> ShapeDescription converter. Signed-off-by: Jonghyun Park --- compiler/exo-tflite/src/ExporterUtils.cpp | 14 ++++++++++++++ compiler/exo-tflite/src/ExporterUtils.h | 1 + 2 files changed, 15 insertions(+) diff --git a/compiler/exo-tflite/src/ExporterUtils.cpp b/compiler/exo-tflite/src/ExporterUtils.cpp index bdb953f..c573e1f 100644 --- a/compiler/exo-tflite/src/ExporterUtils.cpp +++ b/compiler/exo-tflite/src/ExporterUtils.cpp @@ -49,6 +49,18 @@ ShapeDescription to_shape_description(const loco::FeatureShape &shape) return res; } +ShapeDescription to_shape_description(const loco::BiasShape &shape) +{ + ShapeDescription res; + + res._rank_known = true; + + res._dims.resize(1); + res._dims.at(0) = shape.length().value(); + + return res; +} + ShapeDescription to_shape_description(const loco::NodeShape &shape) { switch (shape.domain()) @@ -57,6 +69,8 @@ ShapeDescription to_shape_description(const loco::NodeShape &shape) return to_shape_description(shape.as()); case loco::Domain::Feature: return to_shape_description(shape.as()); + case loco::Domain::Bias: + return to_shape_description(shape.as()); default: break; } diff --git a/compiler/exo-tflite/src/ExporterUtils.h b/compiler/exo-tflite/src/ExporterUtils.h index 5a82ba7..c35a28e 100644 --- a/compiler/exo-tflite/src/ExporterUtils.h +++ b/compiler/exo-tflite/src/ExporterUtils.h @@ -50,6 +50,7 @@ struct ShapeDescription ShapeDescription to_shape_description(const loco::TensorShape &shape); ShapeDescription to_shape_description(const loco::FeatureShape &shape); +ShapeDescription to_shape_description(const loco::BiasShape &shape); ShapeDescription to_shape_description(const loco::NodeShape &shape); /** -- 2.7.4