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

Before Change



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

        return iter(ret)

    def __len__(self):

After Change


                    batch_idxs_dict[pid].append(batch_idxs)
                    batch_idxs = []

        avai_pids = copy.deepcopy(self.pids)
        final_idxs = []

        while len(avai_pids) >= self.num_pids_per_batch:
            selected_pids = random.sample(avai_pids, self.num_pids_per_batch)
            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: 3

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: UFAL-DSG/tgen
Commit Name: ec01f586b20cc3e9e15146e71d9248301ba277ae
Time: 2014-07-02
Author: odusek@ufal.mff.cuni.cz
File Name: tgen/rank.py
Class Name: PerceptronRanker
Method Name: _get_rival_candidates


Project Name: openml/openml-python
Commit Name: 67f8e19ec14eed5f58893be6bee44e50519ea2c4
Time: 2017-05-23
Author: feurerm@informatik.uni-freiburg.de
File Name: tests/test_flows/test_flow.py
Class Name: TestFlow
Method Name: test_sklearn_to_upload_to_flow