aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/CL/kernels/CLPoolingLayerKernel.cpp4
-rw-r--r--src/core/NEON/kernels/NEPoolingLayerKernel.cpp14
-rw-r--r--src/runtime/CL/functions/CLPoolingLayer.cpp6
-rw-r--r--src/runtime/NEON/functions/NEPoolingLayer.cpp2
4 files changed, 15 insertions, 11 deletions
diff --git a/src/core/CL/kernels/CLPoolingLayerKernel.cpp b/src/core/CL/kernels/CLPoolingLayerKernel.cpp
index 2c45df8d4d..1d9aa33171 100644
--- a/src/core/CL/kernels/CLPoolingLayerKernel.cpp
+++ b/src/core/CL/kernels/CLPoolingLayerKernel.cpp
@@ -80,7 +80,7 @@ std::tuple<Status, Window, CLPoolingConfig> validate_and_configure_window(ITenso
ARM_COMPUTE_ERROR_ON_NULLPTR(input, output);
// Get data layout
- const DataLayout data_layout = input->data_layout();
+ const DataLayout data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? input->data_layout() : pool_info.data_layout;
const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
@@ -179,7 +179,7 @@ void CLPoolingLayerKernel::configure(const ICLTensor *input, ICLTensor *output,
_input = input;
_output = output;
_pool_info = pool_info;
- _data_layout = input->info()->data_layout();
+ _data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? input->info()->data_layout() : pool_info.data_layout;
int pool_stride_x = 0;
int pool_stride_y = 0;
diff --git a/src/core/NEON/kernels/NEPoolingLayerKernel.cpp b/src/core/NEON/kernels/NEPoolingLayerKernel.cpp
index 75b33f2e90..36116d20ec 100644
--- a/src/core/NEON/kernels/NEPoolingLayerKernel.cpp
+++ b/src/core/NEON/kernels/NEPoolingLayerKernel.cpp
@@ -163,7 +163,7 @@ std::pair<Status, Window> validate_and_configure_window(ITensorInfo *input, ITen
// Output auto inizialitation if not yet initialized
auto_init_if_empty(*output, input->clone()->set_tensor_shape(compute_pool_shape(*input, pool_info)));
- DataLayout data_layout = input->data_layout();
+ const auto data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? input->data_layout() : pool_info.data_layout;
unsigned int num_elems_read_per_iteration = 0;
unsigned int num_elems_horizontal_window = 0;
int pool_stride_x = 0;
@@ -403,9 +403,9 @@ void NEPoolingLayerKernel::configure(const ITensor *input, ITensor *output, cons
const int pool_stride_x = pad_stride_info.stride().first;
// Get data layout
- const DataLayout data_layout = input->info()->data_layout();
- const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
- const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
+ const auto data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? input->info()->data_layout() : pool_info.data_layout;
+ const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
+ const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
// Update pool size in case of global pooling
const Size2D pool_size(
@@ -1932,9 +1932,9 @@ Status NEPoolingLayerKernel::validate(const ITensorInfo *input, const ITensorInf
unsigned int pool_size_y = 0;
// Get data layout
- const DataLayout data_layout = input->data_layout();
- const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
- const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
+ const auto data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? input->data_layout() : pool_info.data_layout;
+ const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
+ const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
pool_size_x = is_global_pooling ? input->dimension(idx_width) : pool_info.pool_size.width;
pool_size_y = is_global_pooling ? input->dimension(idx_height) : pool_info.pool_size.height;
diff --git a/src/runtime/CL/functions/CLPoolingLayer.cpp b/src/runtime/CL/functions/CLPoolingLayer.cpp
index 00e5447875..883183492d 100644
--- a/src/runtime/CL/functions/CLPoolingLayer.cpp
+++ b/src/runtime/CL/functions/CLPoolingLayer.cpp
@@ -49,7 +49,11 @@ void CLPoolingLayer::configure(ICLTensor *input, ICLTensor *output, const Poolin
{
pixel_value = PixelValue(0, data_type, input->info()->quantization_info());
}
- switch(input->info()->data_layout())
+
+ // Data layout
+ const auto data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? input->info()->data_layout() : pool_info.data_layout;
+
+ switch(data_layout)
{
case DataLayout::NCHW:
border_mode = (PoolingType::MAX == pool_info.pool_type) ? BorderMode::REPLICATE : BorderMode::CONSTANT;
diff --git a/src/runtime/NEON/functions/NEPoolingLayer.cpp b/src/runtime/NEON/functions/NEPoolingLayer.cpp
index e1619188d1..6b87189c2b 100644
--- a/src/runtime/NEON/functions/NEPoolingLayer.cpp
+++ b/src/runtime/NEON/functions/NEPoolingLayer.cpp
@@ -41,7 +41,7 @@ void NEPoolingLayer::configure(ITensor *input, ITensor *output, const PoolingLay
_is_global_pooling_layer = (input->info()->dimension(0) == pool_info.pool_size.width) && (input->info()->dimension(1) == pool_info.pool_size.height);
// Get data layout
- _data_layout = input->info()->data_layout();
+ _data_layout = pool_info.data_layout == DataLayout::UNKNOWN ? input->info()->data_layout() : pool_info.data_layout;
// Configure pooling kernel
_pooling_layer_kernel.configure(input, output, pool_info);