From e6c3344f2a76b0724172200b1d5a443393045336 Mon Sep 17 00:00:00 2001 From: Sang-Hoon Park Date: Tue, 17 Sep 2019 08:59:09 +0100 Subject: COMPMID-2637 [CL] fix broadcast pixel-wise multiplication with 5D tensors Broadcast pixel-wise multiplication with 5D tensors is fixed by adding information whether a dimension has been broadcasted to compute correct start offset when adding 3D tensor argument. The testcase that failed is added to the validation test suite. Change-Id: I320876f507012c27b39daae1316f9b69138ed204 Signed-off-by: Sang-Hoon Park Reviewed-on: https://review.mlplatform.org/c/1994 Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins Reviewed-by: Georgios Pinitas --- arm_compute/core/Window.inl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'arm_compute/core/Window.inl') diff --git a/arm_compute/core/Window.inl b/arm_compute/core/Window.inl index eeef3df7b0..589d6bfafc 100644 --- a/arm_compute/core/Window.inl +++ b/arm_compute/core/Window.inl @@ -24,11 +24,12 @@ namespace arm_compute { inline Window::Window(const Window &src) - : _dims() + : _dims(), _is_broadcasted(utility::generate_array::value) { for(size_t i = 0; i < Coordinates::num_max_dimensions; ++i) { set(i, src[i]); + _is_broadcasted[i] = src.is_broadcasted(i); } } @@ -51,6 +52,19 @@ inline void Window::set(size_t dimension, const Window::Dimension &dim) _dims[dimension] = dim; } +inline void Window::set_broadcasted(size_t dimension) +{ + ARM_COMPUTE_ERROR_ON(dimension >= Coordinates::num_max_dimensions); + set(dimension, Dimension(0, 0, 0)); + _is_broadcasted[dimension] = true; +} + +inline bool Window::is_broadcasted(size_t dimension) const +{ + ARM_COMPUTE_ERROR_ON(dimension >= Coordinates::num_max_dimensions); + return _is_broadcasted[dimension]; +} + inline Window Window::collapse_if_possible(const Window &full_window, const size_t first, const size_t last, bool *has_collapsed) const { @@ -110,7 +124,7 @@ inline Window Window::broadcast_if_dimension_le_one(const TensorShape &shape) co { if(shape[d] <= 1) { - broadcastWin.set(d, Dimension(0, 0, 0)); + broadcastWin.set_broadcasted(d); } } return broadcastWin; -- cgit v1.2.1