From 0afe61f88ce3d2f445c5f01ae5567cb1b0b7f303 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Wed, 14 Feb 2024 16:33:31 -0800 Subject: 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 Change-Id: I7369417adbb1106ce34a1978e7f511a30272c318 --- pseudocode/operators/CONV3D.tosac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pseudocode/operators/CONV3D.tosac') 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(acc, apply_mul_s(value, weight)); } } - acc = apply_add_s(acc, bias[(BC == 1) ? 0 : oc]); - tensor_write(output, [N,OD,OH,OW,OC], [n,od,oy,ox,oc], acc); + out_t out = static_cast(acc); + out = apply_add_s(out, bias[(BC == 1) ? 0 : oc]); + tensor_write(output, [N,OD,OH,OW,OC], [n,od,oy,ox,oc], out); } -- cgit v1.2.1