aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Kunze <eric.kunze@arm.com>2022-02-02 11:27:21 -0800
committerEric Kunze <eric.kunze@arm.com>2022-05-16 14:26:44 -0700
commit67a91550dc7691e1c44b1e1f075645ce16b65c3e (patch)
tree87f29fe704a010ee07af5e2c4109a1071c62ae2c
parent0e46364dfea65a7898639dd381250014ccca3efa (diff)
downloadreference_model-67a91550dc7691e1c44b1e1f075645ce16b65c3e.tar.gz
Adjust divisor calculation
Fixes issue where pad_left < stride would cause padding values to be missed Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I2ba0d0969ce1f00e2cb3ca1ab293c5e15a0c7749
-rw-r--r--reference_model/src/ops/tensor_ops.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/reference_model/src/ops/tensor_ops.cc b/reference_model/src/ops/tensor_ops.cc
index 4a56093..862c640 100644
--- a/reference_model/src/ops/tensor_ops.cc
+++ b/reference_model/src/ops/tensor_ops.cc
@@ -407,7 +407,7 @@ ETensor1<int32_t> OpAvgPool2d<Dtype>::calculate_div_map_1d(int in_size, int out_
// adjust divisors on the left side for padding
// We start at the leftmost output element, and remove pad_left - (index * stride) elements
// until we have no more padding being used
- for(int index = 0; (index < pad_left / stride) && (index < out_size); index++) {
+ for(int index = 0; (index <= pad_left / stride) && (index < out_size); index++) {
int32_t adjust = pad_left - (index * stride);
result(index) -= adjust;
}