PruneTruong / DenseMatching

Dense matching library based on PyTorch
GNU Lesser General Public License v2.1
689 stars 81 forks source link

A simple correction for torch version check #19

Closed ufukefe closed 2 years ago

ufukefe commented 2 years ago

Hi Prune,

Thanks for your great work!

I have noticed that you have some checks for the grid_sample function's behavior change after torch version >= 1.3

These checks look like; if float(torch.__version__[:3]) >= 1.3:

However, if the torch version is 1.10.x, this check fails (since it compares 1.1 and 1.3 then returns False) and affects the flow values.

I compare the versions with the following lines, and it works properly.

from packaging import version
if version.parse(torch.__version__) >= version.parse("1.3"):
PruneTruong commented 2 years ago

Ah, I hadn't thought about that! Thanks a lot, I will update :)