the model below: how can I use the detached_w(1000*512) parameter as a Variable to be involved in
the computational graph? Anything worth paying attention to?
class CNN(nn.Module):
    def __init__(self):
        super(CNN, self).__init__()
        self.pretrained = models.resnet18(pretrained=True)
        self.modules = list(self.pretrained.children())[:-2]
        self.resnet = nn.Sequential(*self.modules)
        self.layer1 =nn.AvgPool2d(7)
        self.layer2 = self.pretrained.fc
    def forward(self,input):
        o0 = self.resnet(input)
        o1 = self.layer1(o0)
        o2 = o1.squeeze(2)
        o2 = o2.squeeze(2)
        o3 = self.layer2(o2)
        for ii,param in enumerate(self.pretrained.fc.parameters()):
            if ii==0:
                detached_w = param.detach()
        #print(detached_w.size())
        return o3,detached_w