aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Symes <dominic.symes@arm.com>2022-08-15 10:50:57 +0100
committerDominic Symes <dominic.symes@arm.com>2022-08-15 10:50:57 +0100
commit6361d1664c7b82ecc3afdd0eb87e96afea430f89 (patch)
treec17f340980c3bd95217b10fb4699d19ef3ebadec
parent4b867860565221f9a1ec71ea5ceb0434a1460cb0 (diff)
downloadspecification-6361d1664c7b82ecc3afdd0eb87e96afea430f89.tar.gz
PAD: Check output shape
Check output shape matches the padded input shape. Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I8e335ce9b086a36d9e38aa332ecc88782e040cc6
-rw-r--r--chapters/data_layout.adoc10
1 files changed, 6 insertions, 4 deletions
diff --git a/chapters/data_layout.adoc b/chapters/data_layout.adoc
index 0c5c4d6..5ba9012 100644
--- a/chapters/data_layout.adoc
+++ b/chapters/data_layout.adoc
@@ -78,7 +78,7 @@ The pad_const value includes the zero point if the tensor uses a zero point.
|Argument|Type|Name|Shape|Description
|Input|in_out_t*|input1|shape1|Input tensor
-|Attribute|int32_t|padding|[rank(input1),2]|Amount of padding to be done
+|Attribute|int32_t|padding|[rank(shape1),2]|Number of pad elements at the start and end of each dimension
|Attribute|in_out_t|pad_const|-|Constant value to be used as padding
|Output|in_out_t*|output|shape|Output tensor of same type as the input tensor
|===
@@ -87,9 +87,11 @@ The pad_const value includes the zero point if the tensor uses a zero point.
[source,c++]
----
-// Padding sizes must be >= 0.
-for_each(pad_size in padding) {
- ERROR_IF(pad_size < 0);
+// Check output shape matches the padded input shape
+ERROR_IF(rank(shape) != rank(shape1));
+for (i = 0; i < rank(shape); i++) {
+ ERROR_IF(padding[i,0] < 0 || padding[i,1] < 0);
+ ERROR_IF(shape[i] != padding[i, 0] + shape1[i] + padding[i, 1]);
}
for_each(index in shape) {
index1 = index;