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/CONV3D.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/CONV3D.tosac')
-rw-r--r-- | pseudocode/operators/CONV3D.tosac | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pseudocode/operators/CONV3D.tosac b/pseudocode/operators/CONV3D.tosac index 7568564..e53b7eb 100644 --- a/pseudocode/operators/CONV3D.tosac +++ b/pseudocode/operators/CONV3D.tosac @@ -38,6 +38,7 @@ for_each(0 <= n < N, 0 <= od < OD, 0 <= oy < OH, 0 <= ox < OW, 0 <= oc < OC) { 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 : oc]); - tensor_write<out_t>(output, [N,OD,OH,OW,OC], [n,od,oy,ox,oc], acc); + out_t out = static_cast<out_t>(acc); + out = apply_add_s<out_t>(out, bias[(BC == 1) ? 0 : oc]); + tensor_write<out_t>(output, [N,OD,OH,OW,OC], [n,od,oy,ox,oc], out); } |