%%timeit -n 1000000
import torch.nn as nn
1000000 loops, best of 3: 357 ns per loop
%%timeit -n 1000000
import torch.nn
1000000 loops, best of 3: 307 ns per loop
%%timeit -n 1000000
from torch import nn
1000000 loops, best of 3: 864 ns per loop