7c4fd12ab946ad49397ee9e42ae208e6876462e0,src/gluonnlp/data/candidate_sampler.py,UnigramCandidateSampler,hybrid_forward,#UnigramCandidateSampler#Any#Any#Any#Any#,104

Before Change


            are sampled based on the weights specified on creation of the
            UnigramCandidateSampler.
        
        flat_shape = functools.reduce(operator.mul, self._shape)
        idx = F.random.uniform(low=0, high=self.N, shape=flat_shape,
                               dtype="float64").floor()
        prob = F.gather_nd(prob, idx.reshape((1, -1)))
        alias = F.gather_nd(alias, idx.reshape((1, -1)))

After Change


            are sampled based on the weights specified on creation of the
            UnigramCandidateSampler.
        
        candidates_flat = candidates_like.reshape((-1, )).astype("float64")
        idx = F.random.uniform_like(candidates_flat, low=0, high=self.N).floor()
        prob = F.gather_nd(prob, idx.reshape((1, -1)))
        alias = F.gather_nd(alias, idx.reshape((1, -1)))
        where = F.random.uniform_like(candidates_flat) < prob
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: dmlc/gluon-nlp
Commit Name: 7c4fd12ab946ad49397ee9e42ae208e6876462e0
Time: 2019-10-25
Author: lausen@amazon.com
File Name: src/gluonnlp/data/candidate_sampler.py
Class Name: UnigramCandidateSampler
Method Name: hybrid_forward


Project Name: nipy/dipy
Commit Name: 979c7a3c28bdf3c5565353987e93de55bf8fb632
Time: 2012-12-28
Author: matthew.brett@gmail.com
File Name: dipy/reconst/multi_voxel.py
Class Name:
Method Name: _squash


Project Name: GPflow/GPflow
Commit Name: d1ac7b831ad36cd0e4bdd7980819f83208345148
Time: 2018-02-07
Author: alex.ialongo@gmail.com
File Name: gpflow/expectations.py
Class Name:
Method Name: _expectation