1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
7.05k stars 1.34k forks source link

Minor fixes for compatiliby with PyTorch 4.1 and Python 2.7. #99

Closed ashafaei closed 6 years ago

ashafaei commented 6 years ago

I checked the previous documentations of flip on PyTorch. It seems like they have never accepted a negative input dimension. I'm not sure which version of PyTorch you were using. Also it seems like the flip dimension is always 3, along w assuming (n x c x h x w), but you might be also calling this function with (c x h x w) when n=1. So the safest replacement was to call flip(tensor.ndimension()-1). By the way, thanks for such a great contribution.

1adrianb commented 6 years ago

Hi @ashafaei,

Thanks a lot for your contribution. Regarding the flip function, I am using the master version of pytorch (which is the 1.0 pre-release currently) that seem to support negative flipping, but you are right it doesn't have support on the current release. Thanks for correcting this.