I try to output internal layers’ output of a cnn, but why the “preds”  is not a Variable? How to solve this?
class CNN(nn.Module):
    def __init__(self, channel):
        super(CNN, self).__init__()
        self.pretrained = models.resnet18(pretrained=True)
        self.modules = list(self.pretrained.children())[:-3]
        self.resnet = nn.Sequential(*self.modules)
        self.layer1 =nn.AvgPool2d(14)
        self.layer2 = nn.Linear(channel,4)
    def forward(self,input):
        o0 = self.resnet(input)
        o1 = self.layer1(o0)
        o2 = o1.squeeze(2)
        o2 = o2.squeeze(2)
        o3 = self.layer2(o2)
        return o0,o2,o3
input=Variable(torch.FloatTensor(3,3,224,224)).cuda()
cnn=CNN(256).cuda()

att_feats,fc_feats,outputs = cnn(input)
print(outputs)
_ ,preds = torch.max(outputs.data,1)
print(preds)
target = Variable(torch.LongTensor(3,4)).cuda()
criterion=nn.CrossEntropyLoss().cuda()
loss= criterion(outputs,target)

the error looks like:
Variable containing:
-0.1038  0.0071  0.0303  0.0366
-0.0857 -0.0365  0.0138  0.0473
-0.0920 -0.0510  0.0131  0.0482
[torch.cuda.FloatTensor of size 3x4 (GPU 0)]
3
3
3
[torch.cuda.LongTensor of size 3x1 (GPU 0)]
RuntimeError: multi-target not supported at /home/jcc/pytorch/torch/lib/THCUNN/generic/ClassNLLCriterion.cu:17