Error importing torch wrapper for numpy

Hi, newb so thanks for baring with me:

Python 3.5.2, ubuntu 1804. CUDA 9.2
installed pytorch via
conda install pytorch torchvision cuda92 -c pytorch

trying to load custom datasets ( )

when I try to

from torch import np

I get
“ImportError: cannot import name ‘np’”

have tried reinstalling pytorch (same method) = all packages already installed.
tried updating numpy which didn’t work.

Any tips much, much appreciated.


I don’t know where the author of the post got their code, but we don’t have a numpy wrapper for pytorch, as least not officially. If there is, it is not developed or maintained by core devs, and you can’t get it from the official conda package.

The tutorial also looks a bit outdated. I would suggest finding a more modern one.

Ok thanks so much. Makes sense now. Cheers

1 Like