I noticed an interesting thing: being able to import torch modules depends on my current directory. Also, it depends on the presence of the pytorch source code file in the current directory. For example, I have torch.py 47 file containing just two lines:

import torch
import torch.nn

If I try to execute this file “python torch.py 47” it will fail to import torch.nn module. If I remove this file from current directory, watch:
root@Pascal:/home/michael/NN#
root@Pascal:/home/michael/NN# python
>>> import torch
>>> import torch.nn
>>> exit()
root@Pascal:/home/michael/NN#
root@Pascal:/home/michael/NN# cp PyTorch/torch.py .
root@Pascal:/home/michael/NN#
root@Pascal:/home/michael/NN#
root@Pascal:/home/michael/NN# python
>>> import torch
>>> import torch.nn
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named nn
>>>
>>> exit()
root@Pascal:/home/michael/NN#
root@Pascal:/home/michael/NN# rm torch.py*
root@Pascal:/home/michael/NN#
root@Pascal:/home/michael/NN# python
>>> import torch
>>> import torch.nn
>>>
>>> 

Weird, right?