diff options
author | Eric Kunze <eric.kunze@arm.com> | 2024-02-14 16:33:31 -0800 |
---|---|---|
committer | Eric Kunze <eric.kunze@arm.com> | 2024-03-13 16:31:19 -0700 |
commit | 0afe61f88ce3d2f445c5f01ae5567cb1b0b7f303 (patch) | |
tree | bfa03c381634090e9074d3e1167c3256a31f3c84 /pseudocode/operators/DEPTHWISE_CONV2D.tosac | |
parent | 6dd341093507157aabbea00b90ca8902509cfd4f (diff) | |
download | specification-0afe61f88ce3d2f445c5f01ae5567cb1b0b7f303.tar.gz |
Modify convolution operators to improve bias handling
Accumulator size moves to an enumerated attribute, out_t for floating-point changes
to be the size of the input. Bias for floating-point also becomes the bit width
of the input type.
Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Change-Id: I7369417adbb1106ce34a1978e7f511a30272c318
Diffstat (limited to 'pseudocode/operators/DEPTHWISE_CONV2D.tosac')
-rw-r--r-- | pseudocode/operators/DEPTHWISE_CONV2D.tosac | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pseudocode/operators/DEPTHWISE_CONV2D.tosac b/pseudocode/operators/DEPTHWISE_CONV2D.tosac index a473375..419d2eb 100644 --- a/pseudocode/operators/DEPTHWISE_CONV2D.tosac +++ b/pseudocode/operators/DEPTHWISE_CONV2D.tosac @@ -35,6 +35,7 @@ for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW, 0 <= c < C, 0 <= m < M) { acc = apply_add_s<out_t>(acc, apply_mul_s<out_t>(value, weight)); } } - acc = apply_add_s<out_t>(acc, bias[(BC == 1) ? 0 : (c * M) + m]); - tensor_write<out_t>(output, [N,OH,OW,C * M], [n,oy,ox,c * M + m], acc); + out_t out = static_cast<out_t>(acc); + out = apply_add_s<out_t>(out, bias[(BC == 1) ? 0 : (c * M) + m]); + tensor_write<out_t>(output, [N,OH,OW,C * M], [n,oy,ox,c * M + m], out); } |