def prepare_weight_quant(cls, module: QuantWBIOL): cls.validate_8b_bit_width(module.quant_weight_bit_width()) scale = module.quant_weight_scale() zero_point = cls.quant_weight_zero_point(module) signed = module.is_quant_weight_signed weight = module.weight.detach() quant_impl, quant_kwargs = cls.gen_quant_impl_kwargs(scale, zero_point, signed) return quant_impl, (weight,), quant_kwargs
def quant_weight_scale(module: QuantWBIOL): return torch.t(module.quant_weight_scale().type( torch.FloatTensor)).detach()
def quant_weight_scale(module: QuantWBIOL): quant_weight_scale = module.quant_weight_scale() return DPUQuantLayerHandler.neg_scalar_exponent_from_scale( quant_weight_scale)
def quant_weight_scale(cls, module: QuantWBIOL): quant_weight_scale = module.quant_weight_scale() return cls.validate_neg_scalar_int_exponent(quant_weight_scale)