linear¶ class torch.ao.nn.quantized.functional.linear(input, weight, bias=None, scale=None, zero_point=None)[source][source]¶ 對輸入的量化資料應用線性變換:y=xAT+by = xA^T + by=xAT+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)(N,∗,in_features),其中 * 表示任意數量的附加維度 權重:(out_features,in_features)(out\_features, in\_features)(out_features,in_features) 偏置:(out_features)(out\_features)(out_features) 輸出:(N,∗,out_features)(N, *, out\_features)(N,∗,out_features)