The slicing with [None, ...] part adds a new axis (dimension) in place of None. It works for both np.array and tensor in the same way. I prefer to use unsqueeze in tensor for adding axis, but there is no unsqueeze method in numpy.
print(words_np.shape)
# (1407, 7)
words_np[-1][None, ...]
# array([[0, 0, 0, 0, 0, 0, 0]])
words_tensor[-1].unsqueeze(0)
# tensor([[0, 0, 0, 0, 0, 0, 0]])
잘 봤습니다. 좋은 글 감사합니다.