评价此页

Linear#

class torch.ao.nn.qat.Linear(in_features, out_features, bias=True, qconfig=None, device=None, dtype=None)[源代码]#

一个带有 FakeQuantize 模块用于权重的线性模块,用于量化感知训练。

我们采用与 torch.nn.Linear 相同的接口,请参阅 https://pytorch.ac.cn/docs/stable/nn.html#torch.nn.Linear 获取文档。

类似于 torch.nn.Linear,但 FakeQuantize 模块已初始化为默认值。

变量

weight (torch.Tensor) – 用于权重的 fake quant 模块

classmethod from_float(mod, use_precomputed_fake_quant=False)[源代码]#

从 float 模块或 qparams_dict 创建 qat 模块。参数:mod 一个 float 模块,由 torch.ao.quantization 工具生成或直接由用户提供。