4b8716fd4bd6f462a9db9eee958f2508576ec019,gluoncv/utils/nn/matcher.py,BipartiteMatcher,hybrid_forward,#BipartiteMatcher#Any#Any#,65

Before Change


    def hybrid_forward(self, F, x):
        match = F.contrib.bipartite_matching(x, threshold=self._threshold,
                                             is_ascend=self._is_ascend)
        return match[0]


class MaximumMatcher(gluon.HybridBlock):
    A Matcher implementing maximum matching strategy.

After Change


        // make sure if iou(a, y) == iou(b, y), then b should also be a good match
        // otherwise positive/negative samples are confusing
        // potential argmax and max
        pargmax = x.argmax(axis=-1, keepdims=True)  // (B, num_anchor, 1)
        maxs = x.max(axis=-2, keepdims=True)  // (B, 1, num_gt)
        pmax = F.pick(x, pargmax, axis=-1, keepdims=True)   // (B, num_anchor, 1)
        mask = F.broadcast_greater_equal(pmax + self._eps, maxs)  // (B, num_anchor, num_gt)
        mask = F.pick(mask, pargmax, axis=-1, keepdims=True)  // (B, num_anchor, 1)
        new_match = F.where(mask > 0, pargmax, F.ones_like(pargmax) * -1)
        result = F.where(match[0] < 0, new_match.squeeze(axis=-1), match[0])
        return result


class MaximumMatcher(gluon.HybridBlock):
    A Matcher implementing maximum matching strategy.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: dmlc/gluon-cv
Commit Name: 4b8716fd4bd6f462a9db9eee958f2508576ec019
Time: 2018-06-15
Author: cheungchih@gmail.com
File Name: gluoncv/utils/nn/matcher.py
Class Name: BipartiteMatcher
Method Name: hybrid_forward


Project Name: dmlc/gluon-nlp
Commit Name: 4e6f3c26ada09786a1fa97ee174668af588cdd76
Time: 2018-08-16
Author: linhaibin.eric@gmail.com
File Name: gluonnlp/model/sampled_block.py
Class Name: _SampledLogitsHelper
Method Name: hybrid_forward


Project Name: tensorflow/ranking
Commit Name: 6bf3f51cd0a312da842157665663c2dad9983248
Time: 2021-01-29
Author: xuanhui@google.com
File Name: tensorflow_ranking/python/losses_impl.py
Class Name: ClickEMLoss
Method Name: _compute_latent_prob