aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominic Symes <dominic.symes@arm.com>2022-07-04 16:36:37 +0100
committerEric Kunze <eric.kunze@arm.com>2022-08-25 22:23:45 +0000
commiteda7b126d3914e9461cf014439b3571b9e6a9c41 (patch)
tree6f7a6f816b6f2aecd7f7c3a7536f748a5fecbb48
parent74a37cace8b8de155b7ccd9bbe76d7de3eacfd9b (diff)
downloadspecification-eda7b126d3914e9461cf014439b3571b9e6a9c41.tar.gz
TRANSPOSED_CONV2D: Invert pad definition
Increasing output pad values reduces the size of the output region in the old definition. This is counter-intuitive. This patch inverts the sign of the output pad values such that increasing values leads to increasing pad. It also specifies a pad limit range of output pad values that give an output dependent on the whole input. Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I47ff4ee67942aec9e728f0b42d87d20117f0b97a
-rw-r--r--chapters/tensor_ops.adoc12
1 files changed, 6 insertions, 6 deletions
diff --git a/chapters/tensor_ops.adoc b/chapters/tensor_ops.adoc
index 4c9a25b..ca936d4 100644
--- a/chapters/tensor_ops.adoc
+++ b/chapters/tensor_ops.adoc
@@ -396,19 +396,19 @@ include::{generated}/operators/TRANSPOSE_CONV2D.adoc[]
----
ERROR_IF(in_t != int8_t && input_zp != 0); // Zero point only allowed for int8_t
ERROR_IF(weight_t != int8_t && weight_zp != 0);
-ERROR_IF(out_pad_top < 0 || out_pad_bottom < 0);
-ERROR_IF(out_pad_left < 0 || out_pad_right < 0);
+ERROR_IF(out_pad_top <= -KH || out_pad_bottom <= -KH);
+ERROR_IF(out_pad_left <= -KW || out_pad_right <= -KW);
ERROR_IF(stride_y < 1 || stride_x < 1);
-ERROR_IF(OH != (IH - 1) * stride_y - out_pad_top - out_pad_bottom + KH);
-ERROR_IF(OW != (IW - 1) * stride_x - out_pad_left - out_pad_right + KW);
+ERROR_IF(OH != (IH - 1) * stride_y + out_pad_top + out_pad_bottom + KH);
+ERROR_IF(OW != (IW - 1) * stride_x + out_pad_left + out_pad_right + KW);
for_each(index in out_shape) {
tensor_write<out_t>(output, [N,OH,OW,OC], index, bias[index[3]])
}
for_each(0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= oc < OC,
0 <= ic < IC, 0 <= ky < KH, 0 <= kx < KW) {
- oy = iy * stride_y - out_pad_top + ky;
- ox = ix * stride_x - out_pad_left + kx;
+ oy = iy * stride_y + out_pad_top + ky;
+ ox = ix * stride_x + out_pad_left + kx;
if (oy >= 0 && oy < OH && ox >= 0 && ox < OW) {
out_t acc = tensor_read<out_t>(output, [N,OH,OW,OC], [n,oy,ox,oc]);
out_t value = tensor_read<in_t>(input, [N,IH,IW,IC], [n,iy,ix,ic]);