I have solved the issue. Thanks for reply.
This is a complete code for Resnet FCN for classification except train_model function. It works fine on imagewoof dataset and give 90% accuracy. My training is still working.
class ResNet50Bottom(nn.Module):
    def __init__(self, original_model):
        super(ResNet50Bottom, self).__init__()
        self.features = nn.Sequential(*list(original_model.children())[:-2])
        self.conv = nn.Conv2d(512, 10, kernel_size=(7, 7), stride=(1, 1), bias=False)
        
    def forward(self, x):
        x = self.features(x)
        x = self.conv(x)
        return x

res50_model = torchvision.models.resnet34(pretrained=True)
for param in res50_model.parameters():
    param.requires_grad = False
res50_conv2 = ResNet50Bottom(res50_model)
inputs, classes = next(iter(dataloaders['train']))
outputs = res50_conv2(inputs)
outputs.data.shape 
res50_conv2 =res50_conv2.to(device)
criterion = nn.CrossEntropyLoss()
optimizer_conv = optim.SGD(res50_conv2.conv.parameters(), lr=0.001, momentum=0.9)
exp_lr_scheduler = lr_scheduler.StepLR(optimizer_conv, step_size=20, gamma=0.1)

res50_conv2= train_model(res50_conv2, criterion, optimizer_conv, exp_lr_scheduler, num_epochs=30, flag_Load=False)