i tried this way of taking weights from pretrained model. But this gives slightly bad accuracy than the original model.
def forward(self, input):
    #print(input.shape)
    self.conv1_1.weight = vgg16.features[0].weight
    self.conv1_1.bias = vgg16.features[0].bias
    x = self.conv1_1(input)
    x = self.relu1_1(x)
    self.conv1_2.weight = vgg16.features[2].weight
    self.conv1_2.bias = vgg16.features[2].bias
    x = self.conv1_2(x)
    x = self.relu1_2(x)
    x = self.pool1(x)
    #print(x.shape)
    self.conv2_1.weight = vgg16.features[5].weight
    self.conv2_1.bias = vgg16.features[5].bias
    x = self.conv2_1(x)
    x = self.relu2_1(x)
    self.conv2_2.weight = vgg16.features[7].weight
    self.conv2_2.bias = vgg16.features[7].bias
    x = self.conv2_2(x)
    x = self.relu2_2(x)
    x = self.pool2(x)
    #print(x.shape)
    self.conv3_1.weight = vgg16.features[10].weight
    self.conv3_1.bias = vgg16.features[10].bias
    x = self.conv3_1(x)
    x = self.relu3_1(x)
    self.conv3_2.weight = vgg16.features[12].weight
    self.conv3_2.bias = vgg16.features[12].bias
    x = self.conv3_2(x)
    x = self.relu3_2(x)
    x = self.pool3(x)
    #print(x.shape)
    self.conv4_1.weight = vgg16.features[17].weight
    self.conv4_1.bias = vgg16.features[17].bias
    x = self.conv4_1(x)
    x = self.relu4_1(x)
    self.conv4_2.weight = vgg16.features[19].weight
    self.conv4_2.bias = vgg16.features[19].bias
    x = self.conv4_2(x)
    x = self.relu4_2(x)
    x = self.pool4(x)
    #print(x.shape)
    x = self.conv5_1(x)
    x = self.relu5_1(x)
    x = self.conv5_2(x)
    x = self.relu5_2(x)
    x = self.pool5(x)
    #print(x.shape)
    x = self.fc1(x)
    x = self.relu6(x)
    x = self.drop6(x)
    #print(x.shape)
    x = self.fc2(x)
    x = self.relu7(x)
    x = self.drop7(x)
    #print(x.shape)
    x = self.fc3(x)
    #print(x.shape)
    x = self.up(x)
    #print(x.shape)
    return x