From 1b89217ed31dea6433e0f1200341a4f58798c622 Mon Sep 17 00:00:00 2001 From: Pablo Tello Date: Thu, 19 Dec 2019 15:27:34 +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: Ic8594300dc428282f4f9b9196f0d64842b6c1868 Signed-off-by: Pablo Tello Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/c/VisualCompute/ComputeLibrary/+/217277 Tested-by: bsgcomp Reviewed-by: Michalis Spyrou Reviewed-by: Gian Marco Iodice Comments-Addressed: bsgcomp Reviewed-on: https://review.mlplatform.org/c/2505 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- arm_compute/core/NEON/kernels/NESpaceToDepthLayerKernel.h | 1 + src/core/NEON/kernels/NESpaceToDepthLayerKernel.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arm_compute/core/NEON/kernels/NESpaceToDepthLayerKernel.h b/arm_compute/core/NEON/kernels/NESpaceToDepthLayerKernel.h index c9ecdd26f8..8e1fd36e24 100644 --- a/arm_compute/core/NEON/kernels/NESpaceToDepthLayerKernel.h +++ b/arm_compute/core/NEON/kernels/NESpaceToDepthLayerKernel.h @@ -75,6 +75,7 @@ private: const ITensor *_input; /**< Source tensor */ ITensor *_output; /**< Destination tensor */ int32_t _block_shape; /**< Block shape */ + DataLayout _data_layout; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_NESPACETODEPTHLAYERKERNEL_H__ */ diff --git a/src/core/NEON/kernels/NESpaceToDepthLayerKernel.cpp b/src/core/NEON/kernels/NESpaceToDepthLayerKernel.cpp index 4803365013..7b56c43994 100644 --- a/src/core/NEON/kernels/NESpaceToDepthLayerKernel.cpp +++ b/src/core/NEON/kernels/NESpaceToDepthLayerKernel.cpp @@ -66,7 +66,7 @@ Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, i } // namespace NESpaceToDepthLayerKernel::NESpaceToDepthLayerKernel() - : _input(nullptr), _output(nullptr), _block_shape() + : _input(nullptr), _output(nullptr), _block_shape(),_data_layout(DataLayout::UNKNOWN) { } @@ -82,6 +82,7 @@ void NESpaceToDepthLayerKernel::configure(const ITensor *input, ITensor *output, _input = input; _block_shape = block_shape; _output = output; + _data_layout = input->info()->data_layout(); // Configure kernel window Window win = calculate_max_window(*output->info(), Steps()); @@ -100,8 +101,7 @@ void NESpaceToDepthLayerKernel::run(const Window &window, const ThreadInfo &info ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(ICPPKernel::window(), window); - const DataLayout data_layout = _input->info()->data_layout(); - const int channel_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::CHANNEL); + const int channel_idx = get_data_layout_dimension_index(_data_layout, DataLayoutDimension::CHANNEL); const int element_size = _input->info()->element_size(); const size_t channel_size = _input->info()->dimension(channel_idx); -- cgit v1.2.1