kmkurn / pytorch-crf

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

Warning: where received a uint8 condition tensor #92

Closed erickrf closed 2 years ago

erickrf commented 2 years ago

I got a warning from torch about line 249: https://github.com/kmkurn/pytorch-crf/blob/e843718540512eb04d9b756fca04a0915affe175/torchcrf/__init__.py#L249

UserWarning: where received a uint8 condition tensor. This behavior is deprecated and will be removed in a future version of PyTorch. Use a boolean condition instead. (Triggered internally at  ../aten/src/ATen/native/TensorCompare.cpp:328.)

I suppose casting the tensor to bool should fix it.

kmkurn commented 2 years ago

Thanks for reporting. Do you mind creating a PR for this?