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 @@ -262,6 +262,9 @@ def compute_multiplier_and_shift(
262262 if shift > 62 :
263263 multiplier = multiplier >> min (31 , shift - 62 )
264264 shift = 62
265+
266+ assert multiplier >= 0 , "Multiplier should be non-negative"
267+ assert shift >= 2 and shift <= 62 , "Shift should be in range [2, 62]"
265268 multipliers .append (multiplier )
266269 shifts .append (shift )
267270 return multipliers , shifts
@@ -315,8 +318,8 @@ def build_rescale(
315318 import serializer .tosa_serializer as ts # type: ignore
316319 import tosa .Op as TosaOp # type: ignore
317320
318- scaleWidth = 32
319- is_scale32 = True
321+ scaleWidth = 16 if input_node . dtype == ts . DType . INT48 else 32
322+ is_scale32 = False if input_node . dtype == ts . DType . INT48 else True
320323 multipliers , shifts = compute_multiplier_and_shift (scale , scaleWidth )
321324 rescale_inputs = create_const_ops_for_rescale (
322325 tosa_fb ,
You can’t perform that action at this time.
0 commit comments