評價此頁

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.com.tw/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 工具生成或直接由使用者提供。