From 67a91550dc7691e1c44b1e1f075645ce16b65c3e Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Wed, 2 Feb 2022 11:27:21 -0800 Subject: Adjust divisor calculation Fixes issue where pad_left < stride would cause padding values to be missed Signed-off-by: Eric Kunze Change-Id: I2ba0d0969ce1f00e2cb3ca1ab293c5e15a0c7749 --- reference_model/src/ops/tensor_ops.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 OpAvgPool2d::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; } -- cgit v1.2.1