File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,9 @@ def compute_multiplier_and_shift(
268268 if shift > 62 :
269269 multiplier = multiplier >> min (31 , shift - 62 )
270270 shift = 62
271+
272+ assert multiplier >= 0 , "Multiplier should be non-negative"
273+ assert shift >= 2 and shift <= 62 , "Shift should be in range [2, 62]"
271274 multipliers .append (multiplier )
272275 shifts .append (shift )
273276 return multipliers , shifts
@@ -322,8 +325,8 @@ def build_rescale(
322325
323326 import tosa .Op as TosaOp # type: ignore
324327
325- scaleWidth = 32
326- is_scale32 = True
328+ scaleWidth = 16 if input_node . dtype == ts . DType . INT48 else 32
329+ is_scale32 = False if input_node . dtype == ts . DType . INT48 else True
327330 multipliers , shifts = compute_multiplier_and_shift (scale , scaleWidth )
328331 rescale_inputs = create_const_ops_for_rescale (
329332 tosa_fb ,
You can’t perform that action at this time.
0 commit comments