Enable static_assert in NeuralNetwors.cpp (#508)
author김수진/동작제어Lab(SR)/Engineer/삼성전자 <sjsujin.kim@samsung.com>
Mon, 9 Apr 2018 10:20:03 +0000 (19:20 +0900)
committer최형규/동작제어Lab(SR)/Senior Engineer/삼성전자 <hk0110.choi@samsung.com>
Mon, 9 Apr 2018 10:20:03 +0000 (19:20 +0900)
This commit enables static_assert in NeuralNetwors.cpp
The assertions of 'OEM Operations' are commented out in current scope now.

Signed-off-by: sjsujinkim <sjsujin.kim@samsung.com>
src/runtime/ref/nn/runtime/NeuralNetworks.cpp

index 485e7f4..858aa85 100644 (file)
@@ -38,8 +38,6 @@
 #include <vector>
 #endif
 
-// TODO-NNRT Uncomment these static asserts once ready
-#if 0 // REF-ANN
 // Make sure the constants defined in the header files have not changed values.
 // IMPORTANT: When adding new values, update kNumberOfDataTypes or kNumberOfDataTypesOEM
 // in Utils.h.
@@ -51,10 +49,11 @@ static_assert(ANEURALNETWORKS_TENSOR_FLOAT32 == 3,
 static_assert(ANEURALNETWORKS_TENSOR_INT32 == 4, "ANEURALNETWORKS_TENSOR_INT32 has changed");
 static_assert(ANEURALNETWORKS_TENSOR_QUANT8_ASYMM == 5,
               "ANEURALNETWORKS_TENSOR_QUANT8_ASYMM has changed");
+#if 0 // TODO-NNRT : If we consider OEM operations, it will enable.
 static_assert(ANEURALNETWORKS_OEM_SCALAR == 10000, "ANEURALNETWORKS_OEM_SCALAR has changed");
 static_assert(ANEURALNETWORKS_TENSOR_OEM_BYTE == 10001,
               "ANEURALNETWORKS_TENSOR_OEM_BYTE has changed");
-
+#endif
 // IMPORTANT: When adding new values, update kNumberOfOperationTypes or
 // kNumberOfOperationTypesOEMin Utils.h.
 static_assert(ANEURALNETWORKS_ADD == 0, "ANEURALNETWORKS_ADD has changed");
@@ -97,9 +96,10 @@ static_assert(ANEURALNETWORKS_SPACE_TO_DEPTH == 26,
               "ANEURALNETWORKS_SPACE_TO_DEPTH has changed");
 static_assert(ANEURALNETWORKS_SVDF == 27, "ANEURALNETWORKS_SVDF has changed");
 static_assert(ANEURALNETWORKS_TANH == 28, "ANEURALNETWORKS_TANH has changed");
+#if 0 // TODO-NNRT : If we consider OEM operations, it will enable.
 static_assert(ANEURALNETWORKS_OEM_OPERATION == 10000,
               "ANEURALNETWORKS_OEM_OPERATION has changed");
-
+#endif
 static_assert(ANEURALNETWORKS_FUSED_NONE == 0, "ANEURALNETWORKS_FUSED_NONE has changed");
 static_assert(ANEURALNETWORKS_FUSED_RELU == 1, "ANEURALNETWORKS_FUSED_RELU has changed");
 static_assert(ANEURALNETWORKS_FUSED_RELU1 == 2, "ANEURALNETWORKS_FUSED_RELU1 has changed");
@@ -126,16 +126,20 @@ static_assert(ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES == 128,
 
 // Make sure that the constants are compatible with the values defined in
 // hardware/interfaces/neuralnetworks/1.0/types.hal.
+#if 0 // TODO-NNRT : If we consider OEM operations, it will enable.
 static_assert(static_cast<int32_t>(OperandType::OEM) == ANEURALNETWORKS_OEM_SCALAR,
               "OEM != ANEURALNETWORKS_OEM");
+#endif
 static_assert(static_cast<int32_t>(OperandType::FLOAT32) == ANEURALNETWORKS_FLOAT32,
               "FLOAT32 != ANEURALNETWORKS_FLOAT32");
 static_assert(static_cast<int32_t>(OperandType::INT32) == ANEURALNETWORKS_INT32,
               "INT32 != ANEURALNETWORKS_INT32");
 static_assert(static_cast<int32_t>(OperandType::UINT32) == ANEURALNETWORKS_UINT32,
               "UINT32 != ANEURALNETWORKS_UINT32");
+#if 0 // TODO-NNRT : If we consider OEM operations, it will enable.
 static_assert(static_cast<int32_t>(OperandType::TENSOR_OEM_BYTE) == ANEURALNETWORKS_TENSOR_OEM_BYTE,
               "TENSOR_OEM_BYTE != ANEURALNETWORKS_TENSOR_OEM_BYTE");
+#endif
 static_assert(static_cast<int32_t>(OperandType::TENSOR_FLOAT32) == ANEURALNETWORKS_TENSOR_FLOAT32,
               "TENSOR_FLOAT32 != ANEURALNETWORKS_TENSOR_FLOAT32");
 static_assert(static_cast<int32_t>(OperandType::TENSOR_QUANT8_ASYMM) ==
@@ -220,7 +224,6 @@ static_assert(static_cast<int32_t>(FusedActivationFunc::RELU1) == ANEURALNETWORK
 static_assert(static_cast<int32_t>(FusedActivationFunc::RELU6) == ANEURALNETWORKS_FUSED_RELU6,
               "FusedActivationFunc::RELU6 != ANEURALNETWORKS_FUSED_RELU6");
 
-#endif
 using android::sp;
 using namespace android::nn;