[nnfw_support_tflite] Introduce TensorUtils.h (#486)
author박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 6 Apr 2018 02:17:29 +0000 (11:17 +0900)
committer김정현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh0822.kim@samsung.com>
Fri, 6 Apr 2018 02:17:29 +0000 (11:17 +0900)
* [nnfw_support_tflite] Introduce TensorUtils.h

This commit introduces TensorUtils.h in nnfw_support_tfilte library.
This header provides various helper functions over TfLiteTensor objects.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
* Remove irrelevant change

include/support/tflite/TensorUtils.h [new file with mode: 0644]
src/support/tflite/src/FeatureView.cpp

diff --git a/include/support/tflite/TensorUtils.h b/include/support/tflite/TensorUtils.h
new file mode 100644 (file)
index 0000000..b44c442
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef __NNFW_SUPPORT_TFLITE_TENSOR_UTILS_H__
+#define __NNFW_SUPPORT_TFLITE_TENSOR_UTILS_H__
+
+#include <tensorflow/contrib/lite/context.h>
+
+namespace nnfw
+{
+namespace support
+{
+namespace tflite
+{
+
+inline bool isFloatTensor(const TfLiteTensor *tensor)
+{
+  return tensor->type == kTfLiteFloat32;
+}
+
+inline bool isFeatureTensor(const TfLiteTensor *tensor)
+{
+  return (tensor->dims->size == 4) && (tensor->dims->data[0] == 1);
+}
+
+} // namespace tflite
+} // namespace support
+} // namespace nnfw
+
+#endif // __NNFW_SUPPORT_TFLITE_TENSOR_UTILS_H__
index 7231f0d..f1a49da 100644 (file)
@@ -1,4 +1,5 @@
 #include "support/tflite/FeatureView.h"
+#include "support/tflite/TensorUtils.h"
 
 #include <cassert>
 
@@ -9,16 +10,6 @@ namespace support
 namespace tflite
 {
 
-inline bool isFloatTensor(const TfLiteTensor *tensor)
-{
-  return tensor->type == kTfLiteFloat32;
-}
-
-inline bool isFeatureTensor(const TfLiteTensor *tensor)
-{
-  return (tensor->dims->size == 4) && (tensor->dims->data[0] == 1);
-}
-
 nnfw::util::feature::Shape getFeatureShape(const TfLiteTensor *tensor)
 {
   nnfw::util::feature::Shape shape;