def _gather_input_scale():
    target_ops = []
    skip_ops = (utils.fake_quantize_dequantize_op_types + ['moving_average_abs_max_scale'])
    for block in program.blocks:
        for op in block.ops:
            if (op.type not in skip_ops):
                target_ops.append(op)
    for op in target_ops:
        for in_var_name in utils._get_op_input_var_names(op):
            previous_op = utils.find_previous_op(op.block, in_var_name)
            if ((previous_op is not None) and (('quantize_dequantize' in previous_op.type) or (previous_op.type == 'moving_average_abs_max_scale'))):
                scale_name = previous_op.output('OutScale')[0]
                in_scale = utils.load_variable_data(scope, scale_name)
                in_scale = utils.fp_numpy_to_naive(in_scale)
                (argname, index) = utils._get_input_name_index(op, in_var_name)
                op._set_attr(((argname + str(index)) + '_threshold'), in_scale)
def _gather_input_scale():
    target_ops = []
    skip_ops = (utils.fake_quantize_dequantize_op_types + ['moving_average_abs_max_scale'])
    for block in program.blocks:
        for op in block.ops:
            if (op.type not in skip_ops):
                target_ops.append(op)
    for op in target_ops:
        for in_var_name in utils._get_op_input_var_names(op):
            previous_op = utils.find_previous_op(op.block, in_var_name)
            if ((previous_op is not None) and (('quantize_dequantize' in previous_op.type) or (previous_op.type == 'moving_average_abs_max_scale'))):
                scale_name = previous_op.output('OutScale')[0]
                in_scale = utils.load_variable_data(scope, scale_name)
                in_scale = utils.fp_numpy_to_naive(in_scale)
                (argname, index) = utils._get_input_name_index(op, in_var_name)
                op._set_attr(((argname + str(index)) + '_threshold'), in_scale)