aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnitha Raj <anitha.raj@arm.com>2023-08-23 11:40:06 +0100
committerAnitha Raj <Anitha.Raj@arm.com>2023-09-04 15:51:06 +0000
commitb566b6e0bf30eb155d44b800454b7ad41e9e7970 (patch)
tree0e5eb6332dadd9d9c942be889a82b68e63ed0de6
parent0d27b2ee8d811d66693555ac1e7be44d93e662e2 (diff)
downloadComputeLibrary-b566b6e0bf30eb155d44b800454b7ad41e9e7970.tar.gz
Extend Neon ReshapeLayer validation tests
- Add a test case with src and dst having same row size - Remove inline from has_holes() util function Related to COMPMID-6504 Change-Id: Iead1f17692dc57b66c5d9f01eed30169efaee0a5 Signed-off-by: Anitha Raj <anitha.raj@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10190 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Gunes Bayir <gunes.bayir@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Benchmark: Arm Jenkins <bsgcomp@arm.com>
-rw-r--r--Android.bp1
-rw-r--r--filelist.json1
-rw-r--r--src/BUILD.bazel1
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/core/helpers/Utils.cpp44
-rw-r--r--src/core/helpers/Utils.h24
-rw-r--r--tests/datasets/ReshapeLayerDataset.h9
-rw-r--r--tests/validation/Helpers.cpp1
-rw-r--r--tests/validation/Helpers.h23
-rw-r--r--tests/validation/fixtures/ReshapeLayerFixture.h6
10 files changed, 64 insertions, 47 deletions
diff --git a/Android.bp b/Android.bp
index dabd70ca93..b5a0ef9f9a 100644
--- a/Android.bp
+++ b/Android.bp
@@ -390,6 +390,7 @@ cc_library_static {
"src/core/Validate.cpp",
"src/core/Version.cpp",
"src/core/helpers/SoftmaxHelpers.cpp",
+ "src/core/helpers/Utils.cpp",
"src/core/helpers/WindowHelpers.cpp",
"src/core/utils/ActivationFunctionUtils.cpp",
"src/core/utils/AssemblyUtils.cpp",
diff --git a/filelist.json b/filelist.json
index 8734c71cba..a3f49d2bae 100644
--- a/filelist.json
+++ b/filelist.json
@@ -26,6 +26,7 @@
"src/core/Validate.cpp",
"src/core/Version.cpp",
"src/core/helpers/SoftmaxHelpers.cpp",
+ "src/core/helpers/Utils.cpp",
"src/core/helpers/WindowHelpers.cpp",
"src/core/utils/ActivationFunctionUtils.cpp",
"src/core/utils/AssemblyUtils.cpp",
diff --git a/src/BUILD.bazel b/src/BUILD.bazel
index a02739f339..0eb27c22ef 100644
--- a/src/BUILD.bazel
+++ b/src/BUILD.bazel
@@ -642,6 +642,7 @@ filegroup(
"core/Validate.cpp",
"core/Version.cpp",
"core/helpers/SoftmaxHelpers.cpp",
+ "core/helpers/Utils.cpp",
"core/helpers/WindowHelpers.cpp",
"core/utils/ActivationFunctionUtils.cpp",
"core/utils/AssemblyUtils.cpp",
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 39fba860fa..8fffa965b9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -634,6 +634,7 @@ target_sources(
core/Validate.cpp
core/Version.cpp
core/helpers/SoftmaxHelpers.cpp
+ core/helpers/Utils.cpp
core/helpers/WindowHelpers.cpp
core/utils/ActivationFunctionUtils.cpp
core/utils/AssemblyUtils.cpp
diff --git a/src/core/helpers/Utils.cpp b/src/core/helpers/Utils.cpp
new file mode 100644
index 0000000000..3900475355
--- /dev/null
+++ b/src/core/helpers/Utils.cpp
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2023 Arm Limited.
+ *
+ * SPDX-License-Identifier: MIT
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+#include "src/core/helpers/Utils.h"
+
+namespace arm_compute
+{
+bool has_holes(const ITensorInfo &info, size_t dimension)
+{
+ const auto &shape = info.tensor_shape();
+ const auto &strides = info.strides_in_bytes();
+ size_t squashed_bytes = info.element_size();
+
+ for(size_t dim = 0; dim <= dimension; ++dim)
+ {
+ if(strides[dim] != squashed_bytes)
+ {
+ return true;
+ }
+ squashed_bytes *= shape[dim];
+ }
+ return false;
+}
+} // namespace arm_compute
diff --git a/src/core/helpers/Utils.h b/src/core/helpers/Utils.h
index 641d536c13..7ad960bfa2 100644
--- a/src/core/helpers/Utils.h
+++ b/src/core/helpers/Utils.h
@@ -21,10 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef SRC_CORE_HELPERS_UTILS_H
-#define SRC_CORE_HELPERS_UTILS_H
+#ifndef ACL_SRC_CORE_HELPERS_UTILS_H
+#define ACL_SRC_CORE_HELPERS_UTILS_H
#include "arm_compute/core/ITensorInfo.h"
+
namespace arm_compute
{
/** Create a strides object based on the provided strides and the tensor dimensions.
@@ -100,23 +101,8 @@ inline unsigned int get_next_power_two(unsigned int x)
* @note This function checks for holes in all the dimensions upto and including the highest dimension.
*
*/
-inline bool has_holes(const ITensorInfo &info, size_t dimension)
-{
- const auto &shape = info.tensor_shape();
- const auto &strides = info.strides_in_bytes();
- size_t squashed_bytes = info.element_size();
-
- for(size_t dim = 0; dim <= dimension; ++dim)
- {
- if(strides[dim] != squashed_bytes)
- {
- return true;
- }
- squashed_bytes *= shape[dim];
- }
- return false;
-}
+bool has_holes(const ITensorInfo &info, size_t dimension);
} // namespace arm_compute
-#endif /* SRC_CORE_HELPERS_UTILS_H */
+#endif // ACL_SRC_CORE_HELPERS_UTILS_H
diff --git a/tests/datasets/ReshapeLayerDataset.h b/tests/datasets/ReshapeLayerDataset.h
index d1a1667683..015f9157aa 100644
--- a/tests/datasets/ReshapeLayerDataset.h
+++ b/tests/datasets/ReshapeLayerDataset.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 Arm Limited.
+ * Copyright (c) 2017-2018, 2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -21,8 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_TEST_RESHAPE_LAYER_DATASET
-#define ARM_COMPUTE_TEST_RESHAPE_LAYER_DATASET
+#ifndef ACL_TESTS_DATASETS_RESHAPELAYERDATASET_H
+#define ACL_TESTS_DATASETS_RESHAPELAYERDATASET_H
#include "utils/TypePrinter.h"
@@ -111,9 +111,10 @@ public:
add_config(TensorShape(17U, 3U, 12U), TensorShape(1U, 1U, 612U));
add_config(TensorShape(26U, 26U, 32U), TensorShape(13U, 13U, 128U));
add_config(TensorShape(31U, 23U, 4U, 7U), TensorShape(2U, 14U, 713U));
+ add_config(TensorShape(8U, 8U, 8U), TensorShape(8U, 64U));
}
};
} // namespace datasets
} // namespace test
} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_RESHAPE_LAYER_DATASET */
+#endif // ACL_TESTS_DATASETS_RESHAPELAYERDATASET_H
diff --git a/tests/validation/Helpers.cpp b/tests/validation/Helpers.cpp
index 2c2d364c51..5e02cc843c 100644
--- a/tests/validation/Helpers.cpp
+++ b/tests/validation/Helpers.cpp
@@ -350,7 +350,6 @@ void add_padding_x(std::initializer_list<ITensor *> tensors, const DataLayout &d
}
}
-
QuantizationInfo calculate_mat_mul_dst_q_info(const QuantizationInfo &a_q_info, const QuantizationInfo &b_q_info, int m, int n, int k, DataType data_type)
{
ARM_COMPUTE_UNUSED(m, n);
diff --git a/tests/validation/Helpers.h b/tests/validation/Helpers.h
index 3f91d55db1..c9d990d3a2 100644
--- a/tests/validation/Helpers.h
+++ b/tests/validation/Helpers.h
@@ -21,8 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ACL_TESTS_VALIDATION_HELPERS
-#define ACL_TESTS_VALIDATION_HELPERS
+#ifndef ACL_TESTS_VALIDATION_HELPERS_H
+#define ACL_TESTS_VALIDATION_HELPERS_H
#include "arm_compute/core/Types.h"
#include "arm_compute/core/Utils.h"
@@ -112,23 +112,6 @@ std::pair<T, T> get_activation_layer_test_bounds(ActivationLayerInfo::Activation
return bounds;
}
-/** Calculate output tensor shape give a vector of input tensor to concatenate
- *
- * @param[in] input_shapes Shapes of the tensors to concatenate across depth.
- *
- * @return The shape of output concatenated tensor.
- */
-TensorShape calculate_depth_concatenate_shape(const std::vector<TensorShape> &input_shapes);
-
-/** Calculate output tensor shape for the concatenate operation along a given axis
- *
- * @param[in] input_shapes Shapes of the tensors to concatenate across width.
- * @param[in] axis Axis to use for the concatenate operation
- *
- * @return The shape of output concatenated tensor.
- */
-TensorShape calculate_concatenate_shape(const std::vector<TensorShape> &input_shapes, size_t axis);
-
/** Convert an asymmetric quantized simple tensor into float using tensor quantization information.
*
* @param[in] src Quantized tensor.
@@ -250,4 +233,4 @@ QuantizationInfo calculate_mat_mul_dst_q_info(const QuantizationInfo &lhs_q_info
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* ACL_TESTS_VALIDATION_HELPERS */
+#endif // ACL_TESTS_VALIDATION_HELPERS_H
diff --git a/tests/validation/fixtures/ReshapeLayerFixture.h b/tests/validation/fixtures/ReshapeLayerFixture.h
index 8182350f5a..5be431f8cf 100644
--- a/tests/validation/fixtures/ReshapeLayerFixture.h
+++ b/tests/validation/fixtures/ReshapeLayerFixture.h
@@ -21,8 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#ifndef ARM_COMPUTE_TEST_RESHAPE_LAYER_FIXTURE
-#define ARM_COMPUTE_TEST_RESHAPE_LAYER_FIXTURE
+#ifndef ACL_TESTS_VALIDATION_FIXTURES_RESHAPELAYERFIXTURE_H
+#define ACL_TESTS_VALIDATION_FIXTURES_RESHAPELAYERFIXTURE_H
#include "arm_compute/core/TensorShape.h"
#include "arm_compute/core/Types.h"
@@ -134,4 +134,4 @@ public:
} // namespace validation
} // namespace test
} // namespace arm_compute
-#endif /* ARM_COMPUTE_TEST_RESHAPE_LAYER_FIXTURE */
+#endif // ACL_TESTS_VALIDATION_FIXTURES_RESHAPELAYERFIXTURE_H