Linear¶
- class torch.ao.nn.quantized.Linear(in_features, out_features, bias_=True, dtype=torch.qint8)[原始碼][原始碼]¶
一個量化的線性模組,其輸入和輸出都是量化的張量。我們採用與 torch.nn.Linear 相同的介面,請參閱 https://pytorch.dev.org.tw/docs/stable/nn.html#torch.nn.Linear 以取得文件。
與
Linear
類似,屬性將在模組建立時隨機初始化,並在稍後被覆寫- 變數
範例
>>> m = nn.quantized.Linear(20, 30) >>> input = torch.randn(128, 20) >>> input = torch.quantize_per_tensor(input, 1.0, 0, torch.quint8) >>> output = m(input) >>> print(output.size()) torch.Size([128, 30])