Note that you are trying to cast the output of the embedding layer in this line of code:
e(x_categorical[:,i]).type(torch.LongTensor)

while the input is expected to be a LongTensor. Could this be the error?