From 58026d6839617f648ef8f7c6e106cf5acf2a4cc2 Mon Sep 17 00:00:00 2001 From: Jeremy Johnson Date: Tue, 19 Oct 2021 15:56:42 +0100 Subject: Fix pool2d generation and check to match specification Change output size error_if check in ref model to match specification. Remove size check from test generation as output shape is always correctly calculated. Change-Id: I5be64f31e6448b47e80fc0a4af11bb312f366a26 Signed-off-by: Jeremy Johnson --- reference_model/src/ops/tensor_ops.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'reference_model/src/ops/tensor_ops.cc') diff --git a/reference_model/src/ops/tensor_ops.cc b/reference_model/src/ops/tensor_ops.cc index be4e4aa..059638a 100644 --- a/reference_model/src/ops/tensor_ops.cc +++ b/reference_model/src/ops/tensor_ops.cc @@ -92,13 +92,8 @@ int check_pool2d_attribute_common(tosa::TosaPoolAttribute* attribute, return 1; } - int32_t allowed_min_input_height = (OH * stride_y) - pad_top - pad_bottom - stride_y + kernel_y; - int32_t allowed_min_input_width = (OW * stride_x) - pad_left - pad_right - stride_x + kernel_x; - - int32_t d_height = IH - allowed_min_input_height; - int32_t d_width = IW - allowed_min_input_width; - - if (d_height < 0 || d_height > stride_y || d_width < 0 || d_width > stride_x) + if ( OH != (IH + pad_top + pad_bottom + stride_y - kernel_y) / stride_y || + OW != (IW + pad_left + pad_right + stride_x - kernel_x) / stride_x ) { msg = "Mismatch between output shape provided and expected output shape"; return 1; -- cgit v1.2.1