Module 'torch' has no attribute 'Module'

I get this error after installing the latest version of torch .module ‘torch’ has no attribute ‘Module’. i did re-install it. Not sure how to go about it

1 Like

Module is defined in the torch.nn namespace, so torch.nn.Module should work.

hahaha,may be you use
import torch as nn
the correct is
from torch import nn

1 Like

import torch.nn as nn