I am trying to import the class BasicBlock
from torchvision.models.resnet
by doing this
from torchvision.models.resnet import *
It is giving no error but when I am trying to use BasicBlock
class in my code (which is supposed to be imported already), I am getting the error that
NameError: name 'BasicBlock' is not defined
even though BasicBlock
is present in torchvision.models.resnet
But it gives no error when I import like this
from torchvision.models.resnet import BasicBlock
and then use it in my code
Why am I getting this error?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…