sure, no problem.
before x = x[-1,:,:],  x.shape = torch.Size([40, 32, 100])
after x = x[-1,:,:],  x.shape = torch.Size([32, 100])
after fully connected layer, x.shape = torch.Size([32, 1])
if the slice is in the batch dimension, the code should throw error. since 40(max sentence length) != 32. thanks.