Thanks for the reply.
All commented dimensions are results by calling tensor.shape.
I’ll further explain the specific numbers
# print(model) result
NERModel(
  (embedding): Embedding(30290, 256)
  (LSTM): LSTM(256, 256, batch_first=True)
  (dense1): Linear(in_features=256, out_features=256, bias=True)
  (dense2): Linear(in_features=256, out_features=6, bias=True)
)

batch_size = 64
length_of_each_input = 124 words

As forward() function being invoked, I didn’t modify any intermediate dimensions and the output by my neural network was [64, 124, 6]. 64 is the batch size, and for each sentence with 124 words, 6 log_softmax results were calculated for each word.
It seems that I need to make it [64, 6, 124] so that I could call the loss function?