评价此页

Linear#

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

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

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

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

变量

weight (torch.Tensor) – 权重 FakeQuantize 模块

classmethod from_float(mod, use_precomputed_fake_quant=False)[source]#

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