aboutsummaryrefslogtreecommitdiff
path: root/tests/Utils.h
diff options
context:
space:
mode:
authorSiCong Li <sicong.li@arm.com>2017-06-19 13:41:45 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:14:20 +0100
commitbacaf9af9b23b01e646a2e206e119a9d8e099a70 (patch)
tree7a30f22a6b1176102204077806dc0a6f1a46138d /tests/Utils.h
parent50f9fd73536fd359137702ac9c42c9a1c61ff415 (diff)
downloadComputeLibrary-bacaf9af9b23b01e646a2e206e119a9d8e099a70.tar.gz
COMPMID-424 Add CL validation tests for Box3x3
* Add tests for different border modes * Add padding calculator Change-Id: Ic4708faddfb1c8e6b59d349cf9cb48c9a181d717 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/78105 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com>
Diffstat (limited to 'tests/Utils.h')
-rw-r--r--tests/Utils.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/Utils.h b/tests/Utils.h
index b2d4bf4f90..f06799017a 100644
--- a/tests/Utils.h
+++ b/tests/Utils.h
@@ -451,16 +451,27 @@ inline I foldl(F &&func, I &&initial, T &&value, Vs &&... values)
return foldl(std::forward<F>(func), func(std::forward<I>(initial), std::forward<T>(value)), std::forward<Vs>(values)...);
}
-/** Create a valid region covering the enitre tensor shape.
+/** Create a valid region based on tensor shape, border mode and border size
*
- * @param[in] shape Shape used as size of the valid region.
+ * @param[in] shape Shape used as size of the valid region.
+ * @param[in] border_undefined (Optional) Boolean indicating if the border mode is undefined.
+ * @param[in] border_size (Optional) Border size used to specify the region to exclude.
*
- * @return A valid region starting at (0, 0, ...) with size of @p shape.
+ * @return A valid region starting at (0, 0, ...) with size of @p shape if @p border_undefined is false; otherwise
+ * return A valid region starting at (@p border_size.left, @p border_size.top, ...) with reduced size of @p shape.
*/
-inline ValidRegion shape_to_valid_region(TensorShape shape)
+inline ValidRegion shape_to_valid_region(TensorShape shape, bool border_undefined = false, BorderSize border_size = BorderSize(0))
{
Coordinates anchor;
- anchor.set(std::max<int>(0, shape.num_dimensions() - 1), 0);
+ anchor.set(std::max(0, static_cast<int>(shape.num_dimensions()) - 1), 0);
+ if(border_undefined)
+ {
+ ARM_COMPUTE_ERROR_ON(shape.num_dimensions() < 2);
+ anchor.set(0, border_size.left);
+ anchor.set(1, border_size.top);
+ shape.set(0, shape.x() - border_size.left - border_size.right);
+ shape.set(1, shape.y() - border_size.top - border_size.bottom);
+ }
return ValidRegion(std::move(anchor), std::move(shape));
}