pytorch/test/cpp
Kurt Mohler 3fe4718d16 Add padding_idx argument to EmbeddingBag (#49237)
Summary:
This PR adds a `padding_idx` parameter to `nn.EmbeddingBag` and `nn.functional.embedding_bag`. As with `nn.Embedding`'s `padding_idx` argument, if an embedding's index is equal to `padding_idx` it is ignored, so it is not included in the reduction.

This PR does not add support for `padding_idx` for quantized or ONNX `EmbeddingBag` for opset10/11 (opset9 is supported). In these cases, an error is thrown if `padding_idx` is provided.

Fixes https://github.com/pytorch/pytorch/issues/3194

Pull Request resolved: https://github.com/pytorch/pytorch/pull/49237

Reviewed By: walterddr, VitalyFedyunin

Differential Revision: D26948258

Pulled By: jbschlosser

fbshipit-source-id: 3ca672f7e768941f3261ab405fc7597c97ce3dfc
2021-04-14 09:38:01 -07:00
..
api Add padding_idx argument to EmbeddingBag (#49237) 2021-04-14 09:38:01 -07:00
common
dist_autograd Forbid trailing whitespace (#53406) 2021-03-05 17:22:55 -08:00
jit [PyTorch] Lite interpreter with a backend delegate (#54462) 2021-04-06 00:55:26 -07:00
lite_interpreter_runtime [PyTorch] Lite interpreter with a backend delegate (#54462) 2021-04-06 00:55:26 -07:00
rpc Transition to new tensorpipe::Pipe API. (#55193) 2021-04-02 02:28:07 -07:00
tensorexpr [nnc] Enable CPU fusion only when num_threads == 1 (#55621) 2021-04-14 09:16:54 -07:00
__init__.py