NLLLoss ignore_index


I have a problem where I want to tag words based on if there should be a newline character after them or not, so each word is either tagged SP (for space) or NL (for newline). Since I’m using pack_padded_sequence, my tag vector has a padding value of 0 (and so SP = 1 and NL = 2).

Is that a use-case where I could use ignore_index in NLLLoss? If so, how?