用法:
class torch.nn.quantized.EmbeddingBag(num_embeddings, embedding_dim, max_norm=None, norm_type=2.0, scale_grad_by_freq=False, mode='sum', sparse=False, _weight=None, include_last_offset=False, dtype=torch.quint8)
~EmbeddingBag.weight(Tensor) -形状为 的模块的不可学习量化权重。
一个量化的 EmbeddingBag 模块,以量化的打包权重作为输入。我们采用与
torch.nn.EmbeddingBag
相同的接口,请参阅https://pytorch.org/docs/stable/nn.html#torch.nn.EmbeddingBag 获取文档。与
EmbeddingBag
- 例子::
>>> m = nn.quantized.EmbeddingBag(num_embeddings=10, embedding_dim=12, include_last_offset=True, mode='sum') >>> indices = torch.tensor([9, 6, 5, 7, 8, 8, 9, 2, 8, 6, 6, 9, 1, 6, 8, 8, 3, 2, 3, 6, 3, 6, 5, 7, 0, 8, 4, 6, 5, 8, 2, 3]) >>> offsets = torch.tensor([0, 19, 20, 28, 28, 32]) >>> output = m(indices, offsets) >>> print(output.size()) torch.Size([5, 12]
变量:
相关用法
- Python torch.nn.quantized.Embedding用法及代码示例
- Python torch.nn.quantized.dynamic.LSTM用法及代码示例
- Python torch.nn.quantized.functional.conv2d用法及代码示例
- Python torch.nn.quantized.Quantize用法及代码示例
- Python torch.nn.quantized.dynamic.LSTMCell用法及代码示例
- Python torch.nn.quantized.Conv2d用法及代码示例
- Python torch.nn.quantized.QFunctional用法及代码示例
- Python torch.nn.quantized.functional.conv3d用法及代码示例
- Python torch.nn.quantized.ReLU6用法及代码示例
- Python torch.nn.quantized.Linear用法及代码示例
- Python torch.nn.quantized.functional.conv1d用法及代码示例
- Python torch.nn.quantized.Conv1d用法及代码示例
- Python torch.nn.quantized.FloatFunctional用法及代码示例
- Python torch.nn.quantized.DeQuantize用法及代码示例
- Python torch.nn.quantized.dynamic.RNNCell用法及代码示例
- Python torch.nn.quantized.dynamic.Linear用法及代码示例
- Python torch.nn.quantized.Conv3d用法及代码示例
- Python torch.nn.quantized.dynamic.GRUCell用法及代码示例
- Python torch.nn.InstanceNorm3d用法及代码示例
- Python torch.nn.EmbeddingBag用法及代码示例
- Python torch.nn.Module.register_forward_hook用法及代码示例
- Python torch.nn.AvgPool2d用法及代码示例
- Python torch.nn.PixelShuffle用法及代码示例
- Python torch.nn.CELU用法及代码示例
- Python torch.nn.Hardsigmoid用法及代码示例
注:本文由纯净天空筛选整理自pytorch.org大神的英文原创作品 torch.nn.quantized.EmbeddingBag。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。