SeuTao / RSNA2019_Intracranial-Hemorrhage-Detection

Code for 1st Place Solution in Intracranial Hemorrhage Detection Challenge @ RSNA2019
413 stars 113 forks source link

'async' is a reserved word in Python >= 3.7 #2

Closed cclauss closed 4 years ago

cclauss commented 4 years ago

Change these instances of 'async' to '__non_blocking__' in sync with pytorch/pytorch#4999

flake8 testing of https://github.com/SeuTao/RSNA2019_1st_place_solution on Python 3.8.0

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

./2DCNN/src/predict.py:285:55: E999 SyntaxError: invalid syntax
        labels = labels.view(-1, 6).contiguous().cuda(async=True)
                                                      ^
./2DCNN/src/train.py:54:55: E999 SyntaxError: invalid syntax
        target = target.view(-1, 6).contiguous().cuda(async=True)
                                                      ^
./2DCNN/src/tuils/swa_utils.py:63:30: E999 SyntaxError: invalid syntax
        inputs = inputs.cuda(async=True)
                             ^
3     E999 SyntaxError: invalid syntax
3

https://flake8.pycqa.org/en/latest/user/error-codes.html

On the flake8 test selection, this PR does not focus on "style violations" (the majority of flake8 error codes that psf/black can autocorrect). Instead these tests are focus on runtime safety and correctness:

cclauss commented 4 years ago

These are syntax errors in Python 3.7, 3.8, etc. https://github.com/SeuTao/RSNA2019_1st_place_solution/search?q=async