Yes, I used your code example. When the net is calling, that error appears:
for i, data in enumerate(trainloader, 0): 
        inputs, labels = data 
        inputs, labels = inputs.to(dev), labels.to(dev)
        
        (outputs1, outputs2) = net(inputs)

where the inputs are CIFAR10 and the net is
import torchvision.models as models
import torch.utils.model_zoo as model_zoo

class MyResNet(models.ResNet):
    def __init__(self, block, layers, num_classes=1000, pretrained=False):  #num_classes=1000
        super(MyResNet, self).__init__(block, layers, num_classes)
        if pretrained:
            self.load_state_dict(model_zoo.load_url(models.resnet.model_urls['resnet18']))
        num_ftrs = self.fc.in_features
        self.fc1 = nn.Linear(num_ftrs, 10)
        self.fc2 = nn.Linear(num_ftrs, 10)
        
    def forward(self, x):
        x = self.conv1(x)
        x = self.bn1(x)
        x = self.relu(x)
        x = self.maxpool(x)

        x = self.layer1(x)
        x = self.layer2(x)
        x = self.layer3(x)
        x = self.layer4(x)

        x = self.avgpool(x)
        x = x.view(x.size(0), -1)
        a = self.fc1(x)
        b = self.fc2(x)

        return a, b


Net = MyResNet(models.resnet.BasicBlock, [2, 2, 2, 2], pretrained=True)


net = Net.to(dev)