Hi,
Is there any code line in my loss function to break backpropagation? Because, after started training, loss value plays around the started value, not changed dramatically.
I could not find why.
Thanks in advance.
Train Loses in 10 times epoch:
Train loss: 66.125526
Train loss: 69.031129
Train loss: 66.471873
Train loss: 74.184909
Train loss: 62.160489
Train loss: 63.237526
Train loss: 63.310347
Train loss: 62.977487
Train loss: 71.276782
Train loss: 64.684782
class pairWiseLoss(nn.Module):    
    
    def __init__(self,lambdaValue,lenghtOfHashCode):
        super(pairWiseLoss, self).__init__()
        self.lambdaValue = lambdaValue
        self.l = lenghtOfHashCode
        self.m = lenghtOfHashCode
    
    
    def forward(self, binary1, labels1, binary2, labels2):

        
        similarity = torch.diagonal(torch.mm(labels1, labels2.t()))
        maskCommonLabel = similarity.gt(0.0)
        maskNoCommonLabel = similarity.eq(0.0)
        
        tc = torch.exp(-similarity) * self.lambdaValue * 4 * self.l
        hammingDistance = torch.diagonal( torch.cdist(binary1,binary2, p = 0) )
        
        loss = torch.sum(torch.masked_select(0.5 * F.relu(hammingDistance - tc),maskCommonLabel  )  ) +  torch.sum(torch.masked_select(0.5 * F.relu( self.m - hammingDistance), maskNoCommonLabel ) )
                
        return loss