aboutsummaryrefslogtreecommitdiff
path: root/arm_compute
diff options
context:
space:
mode:
authorSang-Hoon Park <sang-hoon.park@arm.com>2020-01-15 12:39:56 +0000
committerSang-Hoon Park <sang-hoon.park@arm.com>2020-01-17 11:07:38 +0000
commit0cb3da671b652641deff909a21f6e45a550452f1 (patch)
tree0b90345b0c39288140a602104fd1b79ae07239b2 /arm_compute
parent0a958cbb48816a074303ae218a90414fb619efed (diff)
downloadComputeLibrary-0cb3da671b652641deff909a21f6e45a550452f1.tar.gz
COMPMID-2985 change PoolingLayerInfo to struct
Change-Id: I489205c2b65ec82c6d3da4df39c356a53265556b Signed-off-by: Sang-Hoon Park <sang-hoon.park@arm.com> Reviewed-on: https://review.mlplatform.org/c/2597 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Giorgio Arena <giorgio.arena@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute')
-rw-r--r--arm_compute/core/Types.h57
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h10
-rw-r--r--arm_compute/graph/backends/FunctionHelpers.h2
3 files changed, 18 insertions, 51 deletions
diff --git a/arm_compute/core/Types.h b/arm_compute/core/Types.h
index cbcd3fa783..4cec63bff9 100644
--- a/arm_compute/core/Types.h
+++ b/arm_compute/core/Types.h
@@ -1206,13 +1206,12 @@ private:
bool _dequantize_scores;
};
-/** Pooling Layer Information class */
-class PoolingLayerInfo
+/** Pooling Layer Information struct*/
+struct PoolingLayerInfo
{
-public:
/** Default Constructor */
PoolingLayerInfo()
- : _pool_type(PoolingType::MAX), _pool_size(Size2D()), _pad_stride_info(PadStrideInfo()), _exclude_padding(false), _is_global_pooling(false), _fp_mixed_precision(false)
+ : pool_type(PoolingType::MAX), pool_size(Size2D()), pad_stride_info(PadStrideInfo()), exclude_padding(false), is_global_pooling(false), fp_mixed_precision(false)
{
}
/** Default Constructor
@@ -1230,8 +1229,7 @@ public:
PadStrideInfo pad_stride_info = PadStrideInfo(),
bool exclude_padding = false,
bool fp_mixed_precision = false)
- : _pool_type(pool_type), _pool_size(Size2D(pool_size, pool_size)), _pad_stride_info(pad_stride_info), _exclude_padding(exclude_padding), _is_global_pooling(false),
- _fp_mixed_precision(fp_mixed_precision)
+ : pool_type(pool_type), pool_size(Size2D(pool_size, pool_size)), pad_stride_info(pad_stride_info), exclude_padding(exclude_padding), is_global_pooling(false), fp_mixed_precision(fp_mixed_precision)
{
}
/** Default Constructor
@@ -1249,7 +1247,7 @@ public:
PadStrideInfo pad_stride_info = PadStrideInfo(),
bool exclude_padding = false,
bool fp_mixed_precision = false)
- : _pool_type(pool_type), _pool_size(pool_size), _pad_stride_info(pad_stride_info), _exclude_padding(exclude_padding), _is_global_pooling(false), _fp_mixed_precision(fp_mixed_precision)
+ : pool_type(pool_type), pool_size(pool_size), pad_stride_info(pad_stride_info), exclude_padding(exclude_padding), is_global_pooling(false), fp_mixed_precision(fp_mixed_precision)
{
}
/** Default Constructor
@@ -1259,47 +1257,16 @@ public:
* @param[in] pool_type Pooling type @ref PoolingType.
*/
explicit PoolingLayerInfo(PoolingType pool_type)
- : _pool_type(pool_type), _pool_size(Size2D()), _pad_stride_info(PadStrideInfo(1, 1, 0, 0)), _exclude_padding(false), _is_global_pooling(true), _fp_mixed_precision(false)
- {
- }
- /** Get the pooling type */
- PoolingType pool_type() const
- {
- return _pool_type;
- }
- /** Get the pooling size */
- const Size2D &pool_size() const
- {
- return _pool_size;
- }
- /** Get the padding and stride */
- PadStrideInfo pad_stride_info() const
- {
- return _pad_stride_info;
- }
- /** Check if padding is excluded in calculations */
- bool exclude_padding() const
- {
- return _exclude_padding;
- }
- /** Check if a wider accumulator should be used. */
- bool fp_mixed_precision() const
+ : pool_type(pool_type), pool_size(Size2D()), pad_stride_info(PadStrideInfo(1, 1, 0, 0)), exclude_padding(false), is_global_pooling(true), fp_mixed_precision(false)
{
- return _fp_mixed_precision;
- }
- /** Check if is global pooling */
- bool is_global_pooling() const
- {
- return _is_global_pooling;
}
-private:
- PoolingType _pool_type;
- Size2D _pool_size;
- PadStrideInfo _pad_stride_info;
- bool _exclude_padding;
- bool _is_global_pooling;
- bool _fp_mixed_precision;
+ PoolingType pool_type;
+ Size2D pool_size;
+ PadStrideInfo pad_stride_info;
+ bool exclude_padding;
+ bool is_global_pooling;
+ bool fp_mixed_precision;
};
/** ROI Pooling Layer Information class */
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index a7298d6cbf..7d2b7df43b 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 ARM Limited.
+ * Copyright (c) 2017-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -791,17 +791,17 @@ inline TensorShape compute_pool_shape(const ITensorInfo &input, PoolingLayerInfo
TensorShape output_shape{ input.tensor_shape() };
- const bool is_global_pooling = pool_info.is_global_pooling();
+ const bool is_global_pooling = pool_info.is_global_pooling;
const unsigned int idx_width = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::WIDTH);
const unsigned int idx_height = get_data_layout_dimension_index(input.data_layout(), DataLayoutDimension::HEIGHT);
- const unsigned int pool_size_x = is_global_pooling ? output_shape[idx_width] : pool_info.pool_size().width;
- const unsigned int pool_size_y = is_global_pooling ? output_shape[idx_height] : pool_info.pool_size().height;
+ const unsigned int pool_size_x = is_global_pooling ? output_shape[idx_width] : pool_info.pool_size.width;
+ const unsigned int pool_size_y = is_global_pooling ? output_shape[idx_height] : pool_info.pool_size.height;
std::tie(pooled_w, pooled_h) = scaled_dimensions(output_shape[idx_width],
output_shape[idx_height],
pool_size_x,
pool_size_y,
- pool_info.pad_stride_info());
+ pool_info.pad_stride_info);
output_shape.set(idx_width, pooled_w);
output_shape.set(idx_height, pooled_h);
diff --git a/arm_compute/graph/backends/FunctionHelpers.h b/arm_compute/graph/backends/FunctionHelpers.h
index bf0250c623..65a3e15a66 100644
--- a/arm_compute/graph/backends/FunctionHelpers.h
+++ b/arm_compute/graph/backends/FunctionHelpers.h
@@ -1143,7 +1143,7 @@ std::unique_ptr<IFunction> create_pooling_layer(PoolingLayerNode &node)
<< " Data Type: " << input->info()->data_type()
<< " Input shape: " << input->info()->tensor_shape()
<< " Output shape: " << output->info()->tensor_shape()
- << " Pooling info: " << pool_info.pool_type()
+ << " Pooling info: " << pool_info.pool_type
<< std::endl);
return std::move(func);