aboutsummaryrefslogtreecommitdiff
path: root/tests/Utils.h
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2021-02-03 10:32:59 +0000
committerSang-Hoon Park <sang-hoon.park@arm.com>2021-03-08 17:00:45 +0000
commit668ccdcfb81bfab3a2d44cd1ddd956e83a2dfb09 (patch)
treed139e1a770bcfc182f1aef38a1b908d634f9bb1c /tests/Utils.h
parent201e0fee596dafcf9c869a550fae29779aad2394 (diff)
downloadComputeLibrary-668ccdcfb81bfab3a2d44cd1ddd956e83a2dfb09.tar.gz
Add dynamic tensor support to CpuElementwise
The kernels and operators for binary and unary operations are now capable of being configured with dynamic shapes and computing windows at run-time. Additionally, changing arguments' names is done for consistency. Partially Implements: COMPMID-4127 Change-Id: I48e5038692db667dec7cb2b2906fe5683214fe19 Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4973 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Marquez Tello <pablo.tello@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/Utils.h')
-rw-r--r--tests/Utils.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/Utils.h b/tests/Utils.h
index 2569c41a9e..fe9fe712cf 100644
--- a/tests/Utils.h
+++ b/tests/Utils.h
@@ -814,6 +814,59 @@ inline void sync_tensor_if_necessary(TensorType &tensor)
{
ARM_COMPUTE_UNUSED(tensor);
}
+
+/** Construct and return object for dimensions' state filled with the given value
+ *
+ * @param[in] value The value to fill
+ *
+ * @return Constructed class
+ */
+inline ITensorInfo::TensorDimsState construct_dims_state(int32_t value)
+{
+ auto states = ITensorInfo::TensorDimsState{};
+ std::fill(states.begin(), states.end(), value);
+ return states;
+}
+
+/** Construct and return object for dimensions' state filled with the value for dynamic state
+ *
+ * @return Constructed class filled with the value for dynamic state
+ */
+inline ITensorInfo::TensorDimsState construct_dynamic_dims_state()
+{
+ return construct_dims_state(ITensorInfo::get_dynamic_state_value());
+}
+
+/** Construct and return object for dimensions' state filled with the value for non-dynamic state
+ *
+ * @return Constructed class filled with the value for non-dynamic state
+ */
+inline ITensorInfo::TensorDimsState construct_static_dims_state()
+{
+ return construct_dims_state(ITensorInfo::get_static_state_value());
+}
+
+/** Set the dimension states of the given tensor to dynamic
+ *
+ * @param[in] t The tensor to set to dynamic state
+ *
+ */
+template <typename TensorType>
+void set_tensor_dynamic(TensorType &t)
+{
+ t.info()->set_tensor_dims_state(construct_dynamic_dims_state());
+}
+
+/** Set the dimension states of the given tensor to state
+ *
+ * @param[in] t The tensor to set to static state
+ *
+ */
+template <typename TensorType>
+void set_tensor_static(TensorType &t)
+{
+ t.info()->set_tensor_dims_state(construct_static_dims_state());
+}
} // namespace test
} // namespace arm_compute
#endif /* ARM_COMPUTE_TEST_UTILS_H */