aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2018-07-12 17:34:22 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:54:54 +0000
commit6ed43b58e74281cbdde2219962048bc36d560a3b (patch)
tree46400b96c5cc880f8f9b62f51e2d89f8605bb8dd
parent772e17f8a6683cf3f19cba15c7a1e677fe07a559 (diff)
downloadComputeLibrary-6ed43b58e74281cbdde2219962048bc36d560a3b.tar.gz
COMPMID-1188: Report error on graphs that do not support NHWC
Change-Id: I14c6ded780339aa75555ea5f62247c509e64d0b0 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/139797 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
-rw-r--r--arm_compute/core/Error.h24
-rw-r--r--examples/graph_alexnet.cpp3
-rw-r--r--examples/graph_googlenet.cpp3
-rw-r--r--examples/graph_inception_v3.cpp3
-rw-r--r--examples/graph_inception_v4.cpp3
-rw-r--r--examples/graph_lenet.cpp3
-rw-r--r--examples/graph_resnet50.cpp3
-rw-r--r--examples/graph_resnext50.cpp3
-rw-r--r--examples/graph_squeezenet.cpp3
-rw-r--r--examples/graph_squeezenet_v1_1.cpp3
-rw-r--r--examples/graph_vgg16.cpp3
-rw-r--r--examples/graph_vgg19.cpp3
12 files changed, 38 insertions, 19 deletions
diff --git a/arm_compute/core/Error.h b/arm_compute/core/Error.h
index e254956ad7..9f51fa234c 100644
--- a/arm_compute/core/Error.h
+++ b/arm_compute/core/Error.h
@@ -269,6 +269,20 @@ Status create_error(ErrorCode error_code, const char *function, const char *file
*/
#define ARM_COMPUTE_ERROR_LOC(func, file, line, ...) ::arm_compute::error(func, file, line, __VA_ARGS__) // NOLINT
+/** If the condition is true, the given message is printed and program exits
+ *
+ * @param[in] cond Condition to evaluate.
+ * @param[in] ... Message to print if cond is false.
+ */
+#define ARM_COMPUTE_EXIT_ON_MSG(cond, ...) \
+ do \
+ { \
+ if(cond) \
+ { \
+ ARM_COMPUTE_ERROR(__VA_ARGS__); \
+ } \
+ } while(false)
+
#ifdef ARM_COMPUTE_ASSERTS_ENABLED
/** Checks if a status value is valid if not throws an exception with the error
*
@@ -283,13 +297,7 @@ Status create_error(ErrorCode error_code, const char *function, const char *file
* @param[in] ... Message to print if cond is false.
*/
#define ARM_COMPUTE_ERROR_ON_MSG(cond, ...) \
- do \
- { \
- if(cond) \
- { \
- ARM_COMPUTE_ERROR(__VA_ARGS__); \
- } \
- } while(0)
+ ARM_COMPUTE_EXIT_ON_MSG(cond, __VA_ARGS__)
/** If the condition is true, the given message is printed and an exception is thrown
*
@@ -306,7 +314,7 @@ Status create_error(ErrorCode error_code, const char *function, const char *file
{ \
ARM_COMPUTE_ERROR_LOC(func, file, line, __VA_ARGS__); \
} \
- } while(0)
+ } while(false)
/** If the condition is true, the given message is printed and an exception is thrown, otherwise value is returned
*
diff --git a/examples/graph_alexnet.cpp b/examples/graph_alexnet.cpp
index 95d36342f9..bf4d131ac5 100644
--- a/examples/graph_alexnet.cpp
+++ b/examples/graph_alexnet.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_googlenet.cpp b/examples/graph_googlenet.cpp
index e23107f081..ff7992c164 100644
--- a/examples/graph_googlenet.cpp
+++ b/examples/graph_googlenet.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_inception_v3.cpp b/examples/graph_inception_v3.cpp
index 639554ebfc..1b7b0fd6c2 100644
--- a/examples/graph_inception_v3.cpp
+++ b/examples/graph_inception_v3.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_inception_v4.cpp b/examples/graph_inception_v4.cpp
index e048766634..93166a41c2 100644
--- a/examples/graph_inception_v4.cpp
+++ b/examples/graph_inception_v4.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_lenet.cpp b/examples/graph_lenet.cpp
index f90892aeee..9be5bed6a1 100644
--- a/examples/graph_lenet.cpp
+++ b/examples/graph_lenet.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_resnet50.cpp b/examples/graph_resnet50.cpp
index 66fc6e869d..2970037768 100644
--- a/examples/graph_resnet50.cpp
+++ b/examples/graph_resnet50.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_resnext50.cpp b/examples/graph_resnext50.cpp
index c0a2308a1f..0fce3a1b04 100644
--- a/examples/graph_resnext50.cpp
+++ b/examples/graph_resnext50.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_squeezenet.cpp b/examples/graph_squeezenet.cpp
index a290b91148..09fb1c5960 100644
--- a/examples/graph_squeezenet.cpp
+++ b/examples/graph_squeezenet.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_squeezenet_v1_1.cpp b/examples/graph_squeezenet_v1_1.cpp
index 8ce928c5b1..75ea6b258b 100644
--- a/examples/graph_squeezenet_v1_1.cpp
+++ b/examples/graph_squeezenet_v1_1.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_vgg16.cpp b/examples/graph_vgg16.cpp
index 5ff306507f..c2a9b82f68 100644
--- a/examples/graph_vgg16.cpp
+++ b/examples/graph_vgg16.cpp
@@ -59,7 +59,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;
diff --git a/examples/graph_vgg19.cpp b/examples/graph_vgg19.cpp
index 8bf88b96ed..8de0223a48 100644
--- a/examples/graph_vgg19.cpp
+++ b/examples/graph_vgg19.cpp
@@ -58,7 +58,8 @@ public:
}
// Checks
- ARM_COMPUTE_ERROR_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(arm_compute::is_data_type_quantized_asymmetric(common_params.data_type), "Unsupported data type!");
+ ARM_COMPUTE_EXIT_ON_MSG(common_params.data_layout == DataLayout::NHWC, "Unsupported data layout!");
// Print parameter values
std::cout << common_params << std::endl;