From 3c59d5d2b4c20ec64daff76fd04a374c5a5055e0 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Mon, 15 Aug 2022 11:30:33 -0700 Subject: Check that the shape calculation for PAD is correct Matches a corresponding change to the specification Change-Id: If70356e0c78c1c88530e5d2f58bc50de864f249a Signed-off-by: Eric Kunze --- reference_model/src/ops/data_layout.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reference_model/src/ops/data_layout.cc b/reference_model/src/ops/data_layout.cc index 9fe429b..7840450 100644 --- a/reference_model/src/ops/data_layout.cc +++ b/reference_model/src/ops/data_layout.cc @@ -169,6 +169,8 @@ int OpPad::checkTensorAttributes() int32_t pad_front = attribute->padding()[2 * i]; int32_t pad_back = attribute->padding()[2 * i + 1]; ERROR_IF((pad_front < 0) || (pad_back < 0), "OpPad: padding can't be smaller than 0"); + ERROR_IF(out->getShape()[i] != pad_front + in->getShape()[i] + pad_back, + "OpPad: output shape not equal to input plus padding"); paddings_array[i] = std::make_pair(pad_front, pad_back); } -- cgit v1.2.1