快捷方式

linear

class torch.ao.nn.quantized.functional.linear(input, weight, bias=None, scale=None, zero_point=None)[source][source]

對輸入的量化資料應用線性變換:y=xAT+by = xA^T + b。參見 Linear

注意

當前實現會在每次呼叫時打包權重,這會影響效能。如果你想避免開銷,請使用 Linear

引數
  • input (Tensor) – 型別為 torch.quint8 的量化輸入

  • weight (Tensor) – 型別為 torch.qint8 的量化權重

  • bias (Tensor) – 型別為 torch.float 的 None 或 fp32 偏置

  • scale (double) – 輸出縮放因子。如果為 None,則從輸入縮放因子派生

  • zero_point (python:long) – 輸出零點。如果為 None,則從輸入零點派生

返回型別

Tensor

形狀
  • 輸入:(N,,in_features)(N, *, in\_features),其中 * 表示任意數量的附加維度

  • 權重:(out_features,in_features)(out\_features, in\_features)

  • 偏置:(out_features)(out\_features)

  • 輸出:(N,,out_features)(N, *, out\_features)

文件

查閱全面的 PyTorch 開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源