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

Before Change


        sequence.
        
        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


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

Frequency: 3

Non-data size: 8

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: scikit-learn-contrib/sklearn-pandas
Commit Name: 4d620c03521415796745916ccb0267b86693b38c
Time: 2017-04-30
Author: dukebody@gmail.com
File Name: sklearn_pandas/dataframe_mapper.py
Class Name: DataFrameMapper
Method Name: get_names