MaskZeroCriterion

Hi,
İ am trying to convert a lua/torch program to pytorch. I have used nn.MaskZeroCriterion method in lua. Is there any method in pytoch i can use?If not, can you suggest ways how i can implement in pytorch?
thanks

2 Likes

I dont think there is any implementation of maskedcriterion. The best way is to mask the score vector/logits yourself as per this thread, using masked_select. gather doesn’t works for variable length sequences.

Having said that, i’m also interested to know if there’s a better approach to this