From 14d9d986c63eb8f07acec2f075383f9f4843ae1c Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 13 Dec 2019 12:33:09 +0000 Subject: COMPMID-2819: Retain configuration step data layout to avoid side-effects. Configuring functions serially can lead to side-effects in tensor attributes. One of them is the data layout changing in case functions share same IO tensors. Retain DataLayout used during configuration. Change-Id: I17538ce08b86df6986f0fcf21fa6544fbd5bd74b Signed-off-by: Georgios Pinitas Reviewed-on: https://review.mlplatform.org/c/2470 Tested-by: Arm Jenkins Reviewed-by: Giorgio Arena --- src/core/NEON/kernels/NEPoolingLayerKernel.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/core/NEON/kernels/NEPoolingLayerKernel.cpp') diff --git a/src/core/NEON/kernels/NEPoolingLayerKernel.cpp b/src/core/NEON/kernels/NEPoolingLayerKernel.cpp index 4af5424a77..59c3543171 100644 --- a/src/core/NEON/kernels/NEPoolingLayerKernel.cpp +++ b/src/core/NEON/kernels/NEPoolingLayerKernel.cpp @@ -321,7 +321,7 @@ std::pair validate_and_configure_window(ITensorInfo *input, ITen } // namespace NEPoolingLayerKernel::NEPoolingLayerKernel() - : _func(nullptr), _input(nullptr), _output(nullptr), _pool_info(), _num_elems_processed_per_iteration(0), _border_size(0), _is_square(false) + : _func(nullptr), _input(nullptr), _output(nullptr), _pool_info(), _data_layout(DataLayout::UNKNOWN), _num_elems_processed_per_iteration(0), _border_size(0), _is_square(false) { } @@ -364,14 +364,15 @@ void NEPoolingLayerKernel::configure(const ITensor *input, ITensor *output, cons ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), pool_info, pooled_w, pooled_h)); // Set instance variables - _input = input; - _output = output; - _pool_info = pool_info; - _is_square = (pool_size.x() == pool_size.y()); + _input = input; + _output = output; + _pool_info = pool_info; + _data_layout = input->info()->data_layout(); + _is_square = (pool_size.x() == pool_size.y()); // Get data type const DataType data_type = input->info()->data_type(); - const bool is_nchw = data_layout == DataLayout::NCHW; + const bool is_nchw = _data_layout == DataLayout::NCHW; if(data_type == DataType::QASYMM8) { @@ -1846,7 +1847,7 @@ void NEPoolingLayerKernel::run(const Window &window, const ThreadInfo &info) const bool exclude_padding = _pool_info.exclude_padding(); Window window_input(window); - if(_input->info()->data_layout() == DataLayout::NCHW) + if(_data_layout == DataLayout::NCHW) { // Set step for input in x and y direction for the input unsigned int window_x_inc = 0; -- cgit v1.2.1