Sorry for the noob question, but I can’t find an answer anywhere online.

I have a batch of zero padded inputs, representing word vector IDs. I can create an embedding layer and look up those word vector values.

How do I do something simple like add the word vectors for each row, up to word vector X, where X is different for every row?

Even something like torch.nonzero(t) returns a “not implemented for type Variable” error.

The Numpy function would be np.ma.mean()

https://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.mean.html

Is there a way to do this in PyTorch, without batch size == 1, which would backprop loss back to my embedding layer? Thanks!