线性
- 类torch.ao.nn.quantized.Linear(in_features, out_features, bias_=True, dtype=torch.qint8)[源代码]
-
这是一个具有量化张量输入和输出的量化线性模块。它采用了与torch.nn.Linear相同的接口,请参阅https://pytorch.org/docs/stable/nn.html#torch.nn.Linear以获取详细文档。
类似于
Linear
,属性会在模块创建时被随机初始化,之后会被覆盖。- 变量
示例:
>>> m = nn.quantized.Linear(20, 30) >>> input = torch.randn(128, 20) >>> input = torch.quantize_per_tensor(input, 1.0, 0, torch.quint8) >>> output = m(input) >>> print(output.size()) torch.Size([128, 30])
- classmethodfrom_float(mod, use_precomputed_fake_quant=False)[源代码]
-
根据观察到的浮点模块创建量化模块