aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Window.h
diff options
context:
space:
mode:
authorDiego Lopez Recas <Diego.LopezRecas@arm.com>2017-12-18 14:42:56 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:45:00 +0000
commit0021d750d66d199c411df00cdd8308c325f1fef3 (patch)
treeb96e618977442a8aab335c136d369a958998d416 /arm_compute/core/Window.h
parent5b6904b8d9cb5e8a343cde96fd5a8701f44dff90 (diff)
downloadComputeLibrary-0021d750d66d199c411df00cdd8308c325f1fef3.tar.gz
IVGCVSW-863 Broadcast support in CL/NEON Arithmetic Add
Also, added instrumentation to support generic tensor broadcasting for NEON and CL backends. Change-Id: I1bc5747a286e1a4b464c209067581e103d473b9a Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/114201 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/Window.h')
-rw-r--r--arm_compute/core/Window.h57
1 files changed, 51 insertions, 6 deletions
diff --git a/arm_compute/core/Window.h b/arm_compute/core/Window.h
index c890bf8f9e..cca12c9efe 100644
--- a/arm_compute/core/Window.h
+++ b/arm_compute/core/Window.h
@@ -104,6 +104,14 @@ public:
{
_step = step;
}
+ /** Set the dimension's end
+ *
+ * @param[in] end The new end
+ */
+ void set_end(int end)
+ {
+ _end = end;
+ }
private:
int _start; /**< Start of the dimension */
@@ -302,27 +310,64 @@ public:
return slide_window_slice<4>(slice);
}
+ /* Collapse the dimensions between @p first and @p last if possible.
+ *
+ * A dimension is collapsable if it starts from 0 and matches the corresponding dimension in the full_window
+ *
+ * @param[in] full_window Full window @p window has been created from.
+ * @param[in] first Start dimension into which the following are collapsed.
+ * @param[in] last End (exclusive) dimension to collapse.
+ * @param[out] has_collapsed (Optional) Whether the window was collapsed.
+ *
+ * @return Collapsed window.
+ */
+ Window collapse_if_possible(const Window &full_window, size_t first, size_t last, bool *has_collapsed = nullptr) const;
+
/* Collapse the dimensions higher than @p first if possible.
*
* A dimension is collapsable if it starts from 0 and matches the corresponding dimension in the full_window
*
- * @param[in] full_window Full window @p window has been created from.
- * @param[in] first Dimensions into which the following are collapsed.
+ * @param[in] full_window Full window @p window has been created from.
+ * @param[in] first Start dimension into which the following are collapsed.
+ * @param[out] has_collapsed (Optional) Whether the window was collapsed.
*
* @return Collapsed window.
*/
- Window collapse_if_possible(const Window &full_window, size_t first) const;
+ Window collapse_if_possible(const Window &full_window, size_t first, bool *has_collapsed = nullptr) const
+ {
+ return collapse_if_possible(full_window, first, Coordinates::num_max_dimensions, has_collapsed);
+ }
- /* Collapse the dimensions higher than @p first.
+ /* Collapse the dimensions between @p first and @p last.
*
* A dimension is collapsable if it starts from 0 and matches the corresponding dimension in the full_window
*
* @param[in] full_window Full window @p window has been created from.
- * @param[in] first Dimensions into which the following are collapsed.
+ * @param[in] first Start dimension into which the following are collapsed.
+ * @param[in] last End (exclusive) dimension to collapse.
*
* @return Collapsed window if successful.
*/
- Window collapse(const Window &full_window, size_t first) const;
+ Window collapse(const Window &full_window, size_t first, size_t last = Coordinates::num_max_dimensions) const;
+
+ /* Don't advance in the dimension where @p shape is less equal to 1.
+ *
+ * @param[in] shape A TensorShape.
+ *
+ * @return Broadcast window.
+ */
+ Window broadcast_if_dimension_le_one(const TensorShape &shape) const;
+
+ /* Don't advance in the dimension where shape of @p info is less equal to 1.
+ *
+ * @param[in] info An ITensorInfo.
+ *
+ * @return Broadcast window.
+ */
+ Window broadcast_if_dimension_le_one(const ITensorInfo &info) const
+ {
+ return broadcast_if_dimension_le_one(info.tensor_shape());
+ }
private:
/** First slice of the window