[exo-tflite] BiasShape to ShapeDescription Converter (#6289)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 7 Aug 2019 01:30:01 +0000 (10:30 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 7 Aug 2019 01:30:01 +0000 (10:30 +0900)
This commit implements BiasShape -> ShapeDescription converter.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
compiler/exo-tflite/src/ExporterUtils.cpp
compiler/exo-tflite/src/ExporterUtils.h

index bdb953f..c573e1f 100644 (file)
@@ -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<loco::TensorShape>());
     case loco::Domain::Feature:
       return to_shape_description(shape.as<loco::FeatureShape>());
+    case loco::Domain::Bias:
+      return to_shape_description(shape.as<loco::BiasShape>());
     default:
       break;
   }
index 5a82ba7..c35a28e 100644 (file)
@@ -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);
 
 /**