线性

classtorch.ao.nn.quantized.functional.linear(input, weight, bias=None, scale=None, zero_point=None)[源代码]

对输入的量化数据进行线性变换:$y = xA^T + b$。参见Linear

注意

当前实现每次调用时都会打包权重,这会带来性能损耗。如果你想避免这种开销,可以使用Linear

参数
  • 输入 (Tensor) – 类型为 torch.quint8 的量化张量

  • weight (Tensor) – 类型为 torch.qint8 的量化权重

  • bias (Tensor) – 无,或类型为 torch.float 的 fp32 偏置

  • scale (double) - 输出比例。如果未指定,则根据输入比例进行推导。

  • zero_point (python:long) - 输出的零点值。如果未指定,则根据输入的 zero_point 值进行推导。

返回类型

Tensor

形状:
  • 输入: $(N, *, in\_features)$,其中 * 表示任意数量的额外维度。

  • 权重:$(out\_features, in\_features)$

  • 偏置: $(out\_features)$

  • 输出: $(N, *, out\_features)$

本页目录