[torch.nn.EmbeddingBag] Empty bag filled by Nan



I noticed “Empty bags (i.e., having 0-length) will have returned vectors filled by zeros.” in the pytorch document.

you can see it in the picture, where offset1 is [0,1,2,2,2] which represents five bags, the third and fourth bag should be empty, but i got nan instead of zeros, why does this happen?