tripletnet.py
def calc_vse_loss(self, desc_x, general_x, general_y, general_z, has_text):
        """ Both y and z are assumed to be negatives because they are not from the same 
            item as x

            desc_x: Anchor language embedding
            general_x: Anchor visual embedding
            general_y: Visual embedding from another item from input triplet
            general_z: Visual embedding from another item from input triplet
            has_text: Binary indicator of whether x had a text description
        """
        distd1_p = F.pairwise_distance(general_x, desc_x, 2)
        distd1_n1 = F.pairwise_distance(general_y, desc_x, 2)
        distd1_n2 = F.pairwise_distance(general_z, desc_x, 2)
        loss_vse_1 = selective_margin_loss(distd1_p, distd1_n1, self.margin, has_text)
        loss_vse_2 = selective_margin_loss(distd1_p, distd1_n2, self.margin, has_text)
        return (loss_vse_1 + loss_vse_2) / 2.
 Both y and z are assumed to be negatives because they are not from the same 
            item as x

            desc_x: Anchor language embedding
            general_x: Anchor visual embedding
            general_y: Visual embedding from another item from input triplet
            general_z: Visual embedding from another item from input triplet
            has_text: Binary indicator of whether x had a text description
        
Both y and z are assumed to be negatives because they are not from the same
item as x

Anchor language embedding
general_x: Anchor visual embedding
general_y: Visual embedding from another item from input triplet
general_z: Visual embedding from another item from input triplet
has_text: Binary indicator of whether x had a text description
Both y and z are assumed to be negatives because they are not from the same item as x Anchor language embedding general_x : Anchor visual embedding general_y : Visual embedding from another item from input triplet general_z : Visual embedding from another item from input triplet has_text : Binary indicator of whether x had a text description
def calc_vse_loss(self, desc_x, general_x, general_y, general_z, has_text):
        distd1_p = F.pairwise_distance(general_x, desc_x, 2)
        distd1_n1 = F.pairwise_distance(general_y, desc_x, 2)
        distd1_n2 = F.pairwise_distance(general_z, desc_x, 2)
        loss_vse_1 = selective_margin_loss(distd1_p, distd1_n1, self.margin, has_text)
        loss_vse_2 = selective_margin_loss(distd1_p, distd1_n2, self.margin, has_text)
        return (loss_vse_1 + loss_vse_2) / 2.
def calc_vse_loss ( self , desc_x , general_x , general_y , general_z , has_text ) : distd1_p = F . pairwise_distance ( general_x , desc_x , 2 ) distd1_n1 = F . pairwise_distance ( general_y , desc_x , 2 ) distd1_n2 = F . pairwise_distance ( general_z , desc_x , 2 ) loss_vse_1 = selective_margin_loss ( distd1_p , distd1_n1 , self . margin , has_text ) loss_vse_2 = selective_margin_loss ( distd1_p , distd1_n2 , self . margin , has_text ) return ( loss_vse_1 + loss_vse_2 ) / 2.
Both y and z are assumed to be negatives because they are not from the same
item as x
Both y and z are assumed to be negatives because they are not from the same item as x
""" Both y and z are assumed to be negatives because they are not from the same 
            item as x

            desc_x: Anchor language embedding
            general_x: Anchor visual embedding
            general_y: Visual embedding from another item from input triplet
            general_z: Visual embedding from another item from input triplet
            has_text: Binary indicator of whether x had a text description
        """
self
desc_x
general_x
general_y
general_z
has_text