outputs = model(input_img)
f = outputs.data.cpu()
length = f.size()
f = f.view(2048,int(length[1]/2048))f = f.sum(dim=1)
f = f.view(1, 2048)
ff = ff+f
// norm feature
fnorm = torch.norm(ff, p=2, dim=1, keepdim=True)
After Change
for data in dataloaders:
img, label = data
labels = torch.cat((labels,label),0)
n, c, h, w = img.size()
count += n
print(count)
ff = torch.FloatTensor(n,2048).zero_()
for i in range(2):