l2 norm without sav-loss
This commit is contained in:
parent
a3732cff1e
commit
f118b91ed0
|
|
@ -40,9 +40,15 @@ class CNNProjection(nn.Module):
|
||||||
x3 = self.conv_and_pool(x,self.conv15) #(N,Co)
|
x3 = self.conv_and_pool(x,self.conv15) #(N,Co)
|
||||||
x = torch.cat((x1, x2, x3), 1) # (N,len(Ks)*Co)
|
x = torch.cat((x1, x2, x3), 1) # (N,len(Ks)*Co)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
x = F.relu(self.fc1(x)) # (N, C)
|
||||||
|
|
||||||
|
norm = x.norm(p=2, dim=1, keepdim=True)
|
||||||
|
x = x.div(norm.expand_as(x))
|
||||||
|
|
||||||
x = self.dropout(x) # (N, len(Ks)*Co)
|
x = self.dropout(x) # (N, len(Ks)*Co)
|
||||||
logit = F.relu(self.fc1(x)) # (N, C)
|
|
||||||
return logit
|
return x
|
||||||
|
|
||||||
def space_dimensions(self):
|
def space_dimensions(self):
|
||||||
return self.output_size
|
return self.output_size
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue