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)