fc56073588771c81b4e134bff54195f5e74e6b43,thinc/backends/ops.py,Ops,minibatch,#,31

Before Change


        sizes = itertools.repeat(size) if isinstance(size, int) else size
        is_list = isinstance(sequence, list)
        if isinstance(sequence, list):  // need condition here for type checking
            sequence = Objects(sequence)
        indices = numpy.arange(len(sequence))
        if shuffle:
            numpy.random.shuffle(indices)
        i = 0
        queue = []
        while i < indices.shape[0]:  // type: ignore
            batch_size = next(sizes)
            idx_batch = indices[i : i + batch_size]
            subseq = sequence[idx_batch]
            if is_xp_array(subseq):
                subseq = self.as_contig(cast(Array, subseq))
            if is_list and isinstance(subseq, Objects):
                subseq = subseq.data
            queue.append(subseq)
            i += batch_size
        return queue

After Change


        while i < indices.shape[0]:  // type: ignore
            batch_size = next(sizes)
            idx_batch = indices[i : i + batch_size]
            if isinstance(sequence, list):
                subseq = [sequence[i] for i in idx_batch]
            elif isinstance(sequence, tuple):
                subseq = tuple(sequence[i] for i in idx_batch)  // type: ignore
            else:
                subseq = sequence[idx_batch]  // type: ignore
            if is_xp_array(subseq):
                subseq = self.as_contig(cast(Array, subseq))  // type: ignore
            queue.append(subseq)
            i += batch_size
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: explosion/thinc
Commit Name: fc56073588771c81b4e134bff54195f5e74e6b43
Time: 2020-01-21
Author: ines@ines.io
File Name: thinc/backends/ops.py
Class Name: Ops
Method Name: minibatch


Project Name: explosion/thinc
Commit Name: fc56073588771c81b4e134bff54195f5e74e6b43
Time: 2020-01-21
Author: ines@ines.io
File Name: thinc/backends/ops.py
Class Name: Ops
Method Name: multibatch


Project Name: CellProfiler/CellProfiler
Commit Name: 2c307beb19abb8d149c7d2f754e4455ce6fd6463
Time: 2016-03-01
Author: leek@broadinstitute.org
File Name: cellprofiler/modules/tests/test_reassignobjectnumbers.py
Class Name: TestReassignObjectNumbers
Method Name: rruunn