MCPcopy Create free account
hub / github.com/CDTrans/CDTrans / hard_example_mining

Function hard_example_mining

loss/triplet_loss.py:51–104  ·  view source on GitHub ↗

For each anchor, find the hardest positive and negative sample. Args: dist_mat: pytorch Variable, pair wise distance between samples, shape [N, N] labels: pytorch LongTensor, with shape [N] return_inds: whether to return the indices. Save time if `False`(?) Returns: d

(dist_mat, labels, return_inds=False)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers 1

__call__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected