Daeyarn cca 5 min po epohi, ako ti puno traje vjerojatno ti sampling metode pre dugo traju
Probaj ovako:
def _sample_negative(self, index):
anchor_target = self.targets[index].item()
indicies = list()
for tar in self.target2indices:
if (tar != anchor_target):
indicies += self.target2indices[tar]
return choice(indicies)
def _sample_positive(self, index):
anchor_target = self.targets[index].item()
return choice(self.target2indices[anchor_target])