AttributeError: 'str' object has no attribute 'enabled' error

Hello guys,
I would like to know how to solve this type of problem? Assume that my code is:

class MyNet(nn.Module):
def __init__(self, extractor):
    super(MyNet, self).__init__()
    self.features = nn.Sequential(
            # Select Feature
            *list(extractor.children())[:-2]
    )
    self.maxpool1 = nn.MaxPool2d(2,2)
    self.conv1 = nn.Conv2d(512,1024,3,padding=1)
    self.batchNorm1 = nn.BatchNorm2d(1024)
    self.conv2 = nn.Conv2d(1024,512,1)
    self.batchNorm2 = nn.BatchNorm2d(512)
    self.conv3 = nn.Conv2d(512,1024,3,padding=1)
    self.batchNorm3 = nn.BatchNorm2d(1024)
    self.conv4 = nn.Conv2d(1024,512,1)
    self.batchNorm4 = nn.BatchNorm2d(512)
    self.conv5 = nn.Conv2d(512,1024,3,padding=1)
    self.batchNorm5 = nn.BatchNorm2d(1024)
    self.final = nn.Conv2d(1024,30,1)
    
def forward(self, input):
    output = self.features(input)
    output = self.maxpool1(output)
    output = f.leaky_relu(self.batchNorm1(self.conv1(output)),0.1)
    output = f.leaky_relu(self.batchNorm2(self.conv2(output)),0.1)
    output = f.leaky_relu(self.batchNorm3(self.conv3(output)),0.1)
    output = f.leaky_relu(self.batchNorm4(self.conv4(output)),0.1)
    output = f.leaky_relu(self.batchNorm5(self.conv5(output)),0.1)
    output = f.dropout(output, p = 0.5)
    output = self.final(output)
    output = f.sigmoid(output)
    return output

And here is a basic initialization of above class:

resnet18 = torchvision.models.resnet18(pretrained=True)
net = MyNet(resnet18)
for param in net.features.parameters():
    param.requires_grad = False
imageSize = (448,448)
nc = 3
input = V(torch.randn(1,nc,imageSize[0], imageSize[1]))
if cuda:
    net.cuda()
    input = input.cuda()
output = net(input)

But when run above code, I receive following error:
Traceback (most recent call last): File "MyCode.py", line 194, in <module> output = net(input) File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 206, in __call__ result = self.forward(*input, **kwargs) File "MyCode.py", line 110, in forward output = self.features(input) File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 206, in __call__ result = self.forward(*input, **kwargs) File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torch/nn/modules/container.py", line 64, in forward input = module(input) File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 206, in __call__ result = self.forward(*input, **kwargs) File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torch/nn/modules/container.py", line 64, in forward input = module(input) File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 206, in __call__ result = self.forward(*input, **kwargs) File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torchvision-0.1.8-py3.6.egg/torchvision/models/resnet.py", line 46, in forward File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 206, in __call__ result = self.forward(*input, **kwargs) File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py", line 43, in forward self.training, self.momentum, self.eps) File "/home/mlcmdeep/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py", line 438, in batch_norm f = torch._C._functions.BatchNorm(running_mean, running_var, training, momentum, eps, torch.backends.cudnn.enabled) AttributeError: 'str' object has no attribute 'enabled'

Could you please help me?