9aa1aa24c0eaafb95f3a0a580de9df38e803e039,torchreid/samplers.py,RandomIdentitySampler,__iter__,#RandomIdentitySampler#,40

Before Change


            self.length += num - num % self.num_instances

    def __iter__(self):
        list_container = []

        for pid in self.pids:
            idxs = copy.deepcopy(self.index_dic[pid])
            if len(idxs) < self.num_instances:
                idxs = np.random.choice(idxs, size=self.num_instances, replace=True)
            random.shuffle(idxs)
            batch_idxs = []
            for idx in idxs:
                batch_idxs.append(idx)
                if len(batch_idxs) == self.num_instances:
                    list_container.append(batch_idxs)
                    batch_idxs = []

        random.shuffle(list_container)

        ret = []
        for batch_idxs in list_container:
            ret.extend(batch_idxs)

        return iter(ret)

    def __len__(self):
        return self.length

After Change


            for pid in selected_pids:
                batch_idxs = batch_idxs_dict[pid].pop(0)
                final_idxs.extend(batch_idxs)
                if len(batch_idxs_dict[pid]) == 0:
                    avai_pids.remove(pid)

        return iter(final_idxs)

    def __len__(self):
        return self.length
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: KaiyangZhou/deep-person-reid
Commit Name: 9aa1aa24c0eaafb95f3a0a580de9df38e803e039
Time: 2018-08-16
Author: k.zhou@qmul.ac.uk
File Name: torchreid/samplers.py
Class Name: RandomIdentitySampler
Method Name: __iter__


Project Name: biocore/scikit-bio
Commit Name: 672e410167a85c27d87a71c8a09e78a9cdfc3c7c
Time: 2015-04-15
Author: jamietmorton@gmail.com
File Name: skbio/tree/_tree.py
Class Name: TreeNode
Method Name: bifurcate


Project Name: scikit-learn-contrib/categorical-encoding
Commit Name: 3ad234f30b3958752df3060b3e8ab751bffeec6c
Time: 2018-11-19
Author: contact@againstthecurrent.ch
File Name: category_encoders/hashing.py
Class Name: HashingEncoder
Method Name: fit


Project Name: chainer/chainercv
Commit Name: 49bee22f06bc1f15a4ec2dd866b684338c8955b4
Time: 2017-06-18
Author: yuyuniitani@gmail.com
File Name: chainercv/links/model/sequential_feature_extraction_chain.py
Class Name: SequentialFeatureExtractionChain
Method Name: __call__