コード例 #1
0
 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
コード例 #2
0
 def quant_weight_scale(module: QuantWBIOL):
     return torch.t(module.quant_weight_scale().type(
         torch.FloatTensor)).detach()
コード例 #3
0
ファイル: handler.py プロジェクト: uslumt/brevitas
 def quant_weight_scale(module: QuantWBIOL):
     quant_weight_scale = module.quant_weight_scale()
     return DPUQuantLayerHandler.neg_scalar_exponent_from_scale(
         quant_weight_scale)
コード例 #4
0
ファイル: handler.py プロジェクト: fpjentzsch/brevitas
 def quant_weight_scale(cls, module: QuantWBIOL):
     quant_weight_scale = module.quant_weight_scale()
     return cls.validate_neg_scalar_int_exponent(quant_weight_scale)