Just a general note, it’s probably better to do the torch.__file__ checks with via isfile and abspath:
>>> import torch
>>> import os
>>> os.path.isfile(torch.__file__)
True
>>> os.path.abspath(torch.__file__)
'/Users/sebastian/miniconda3/lib/python3.6/site-packages/torch/__init__.py'