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


            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):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

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: enthought/chaco
Commit Name: 6b07ae6f8e587fd27f9b30ec4922e255b428a794
Time: 2008-08-27
Author: kammeyer@651a555e-23ca-0310-84fe-ca9f7c59d2ea
File Name: enthought/chaco/tools/traits_tool.py
Class Name: TraitsTool
Method Name: normal_left_dclick


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