linear¶ class torch.ao.nn.quantized.functional.linear(input, weight, bias=None, scale=None, zero_point=None)[来源][来源]¶ 对输入的量化数据应用线性变换: y=xAT+by = xA^T + by=xAT+b。 参见 Linear 注意 当前实现在每次调用时都会打包权重,这会对性能产生影响。如果您想避免这种开销,请使用 Linear。 参数 input (Tensor) – torch.quint8 类型的量化输入 weight (Tensor) – torch.qint8 类型的量化权重 bias (Tensor) – None 或 torch.float 类型的 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)