kmkurn / pytorch-crf

(Linear-chain) Conditional random field in PyTorch.
https://pytorch-crf.readthedocs.io
MIT License
935 stars 151 forks source link

Clarification about masks #78

Closed ViktorooReps closed 2 years ago

ViktorooReps commented 3 years ago

Hi! Thanks for your great library! Saved me a lot of time.

I've padded RNN inputs and want to feed it's outputs to CRF. If I understood your _compute_score correctly, I need to pad tags tensor as well with some valid tags (to avoid out of bounds exception). These tags won' t affect anything, right?

kmkurn commented 3 years ago

Yes, it should be fine as long as you pass the correct mask. Glad you find the library useful!