From: 오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 Date: Wed, 10 Apr 2019 07:21:19 +0000 (+0900) Subject: Remove unused util function in cpu backend (#4971) X-Git-Tag: accepted/tizen/unified/20190430.113441~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f6b712b39856c2cf8bf27c5426ad98635976900;p=platform%2Fcore%2Fml%2Fnnfw.git Remove unused util function in cpu backend (#4971) Remove unused util function in cpu backend: type conversion to tflite internal type Signed-off-by: Hyeongseok Oh --- diff --git a/runtimes/neurun/backend/cpu/kernel/OperationUtils.h b/runtimes/neurun/backend/cpu/kernel/OperationUtils.h index 95bc16d..1527242 100644 --- a/runtimes/neurun/backend/cpu/kernel/OperationUtils.h +++ b/runtimes/neurun/backend/cpu/kernel/OperationUtils.h @@ -25,9 +25,6 @@ #include -#include "tensorflow/contrib/lite/c/builtin_op_data.h" -#include "tensorflow/contrib/lite/kernels/internal/types.h" -#include "tensorflow/contrib/lite/kernels/internal/tensor.h" #include "model/operand/Object.h" #include "model/operand/DataType.h" @@ -64,51 +61,6 @@ uint32_t getNumberOfElements(const Shape &shape); uint32_t getSizeOfDimension(const Shape &shape, uint32_t dimensionIdx); -inline ::tflite::Dims<4> convertShapeToDims(const Shape &shape) -{ - // nnAssert(shape.dimensions.size() <= 4); - ::tflite::Dims<4> dims; - // The dimensions are reversed in Dims<4>. - for (int i = 0; i < 4; ++i) - { - int src = static_cast(shape.dimensions.size()) - i - 1; - if (src >= 0) - { - dims.sizes[i] = static_cast(getSizeOfDimension(shape, src)); - } - else - { - dims.sizes[i] = 1; - } - } - dims.strides[0] = 1; - for (int i = 1; i < 4; i++) - { - dims.strides[i] = dims.strides[i - 1] * dims.sizes[i - 1]; - } - return dims; -} - -inline ::tflite::RuntimeShape convertShapeToTFLiteShape(const Shape &shape) -{ - std::vector raw_shape; - raw_shape.resize(4); - - for (uint32_t i = 0; i < 4; ++i) - { - if (i >= shape.dimensions.size()) - { - raw_shape[i] = 1; - } - else - { - raw_shape[i] = shape.dimensions[i]; - } - } - - return ::tflite::GetTensorShape(raw_shape); -} - inline nnfw::cker::Shape convertToExtendedCkerShape(const Shape &shape) { std::vector raw_shape; @@ -150,31 +102,6 @@ inline nnfw::cker::Shape convertShapeToCkerShape(const Shape &shape) return nnfw::cker::GetShape(raw_shape); } -inline TfLiteFusedActivation convertFusedActivation(FuseCode act) -{ - if (act == ANEURALNETWORKS_FUSED_NONE) - { - return kTfLiteActNone; - } - - if (act == ANEURALNETWORKS_FUSED_RELU) - { - return kTfLiteActRelu; - } - - if (act == ANEURALNETWORKS_FUSED_RELU1) - { - return kTfLiteActRelu1; - } - - if (act == ANEURALNETWORKS_FUSED_RELU6) - { - return kTfLiteActRelu6; - } - - return kTfLiteActNone; -} - bool QuantizeMultiplier(double double_multiplier, int32_t *quantized_multiplier, int *shift); __wur bool QuantizeMultiplierSmallerThanOne(double double_multiplier, int32_t *quantized_multiplier,