From 671a11e1c8e1e4db7bcae9ce97b0c97ebcb97464 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Fri, 6 Jul 2018 15:11:36 +0100 Subject: COMPMID-1379: Created WindowIterator and TensorAccessor - WindowIterator: used to iterate over arbitrary positions of a window. (More flexible than execute_window_loop which only can iterate over entire dimensions) - TensorAccessor: RSH's code uses pointers to specialised types and strides in element sizes, this helps interfacing with their code. Change-Id: I8ded8758d345668804873409f949b8cec694d289 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/139082 Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- arm_compute/core/Window.inl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'arm_compute/core/Window.inl') diff --git a/arm_compute/core/Window.inl b/arm_compute/core/Window.inl index 8401227eee..c6fc8848aa 100644 --- a/arm_compute/core/Window.inl +++ b/arm_compute/core/Window.inl @@ -247,4 +247,24 @@ inline void Window::use_tensor_dimensions(const TensorShape &shape, size_t first set(n, Window::Dimension(0, std::max(shape[n], static_cast(1)))); } } + +inline TensorShape Window::shape() const +{ + TensorShape shape; + for(size_t d = 0; d < TensorShape::num_max_dimensions; ++d) + { + shape.set(d, (_dims[d].end() - _dims[d].start()) / _dims[d].step()); + } + return shape; +} + +inline size_t Window::num_iterations_total() const +{ + size_t total = 1; + for(size_t d = 0; d < Coordinates::num_max_dimensions; ++d) + { + total *= num_iterations(d); + } + return total; +} } -- cgit v1.2.1