b939c910d036d8197ac7c63e5f188bc4c4fc4803,foolbox/batching.py,,run_parallel,#Any#Any#Any#Any#Any#Any#Any#Any#,94

Before Change


            logging.debug("calling native forward with {}".format(len(attacks_requesting_batched_predictions)))  // noqa: E501
            batched_predictions_args = list(map(np.stack,
                                                zip(*batched_predictions_args)))
            batched_predictions_args = list(batched_predictions_args)
            // get original shape (//attacks, batch size)
            batch_shape = batched_predictions_args[0].shape
            // merge individual batches into one super-batch
            batched_predictions_args[0] = batched_predictions_args[0].reshape(
                -1, *batch_shape[2:])

            batched_predictions = model.forward(*batched_predictions_args)
            // split super-batch back into individual batches
            batched_predictions = batched_predictions.reshape(
                *batch_shape[:2], -1)
        else:
            batched_predictions = []

        if len(attacks_requesting_gradients) > 0:

After Change



            // merge individual batches into one larger super-batch
            batch_lengths = [len(x) for x in inputs]
            batch_splits = np.cumsum(batch_lengths)
            inputs = np.concatenate([x for x in inputs])

            // split super-batch back into individual batches
            batched_predictions = model.forward(inputs)
            batched_predictions = np.split(batched_predictions, batch_splits,
                                           axis=0)

        else:
            batched_predictions = []
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: bethgelab/foolbox
Commit Name: b939c910d036d8197ac7c63e5f188bc4c4fc4803
Time: 2019-07-20
Author: rzrolandzimmermann@gmail.com
File Name: foolbox/batching.py
Class Name:
Method Name: run_parallel


Project Name: fgnt/pb_bss
Commit Name: 32d73ccb0d80db3727775fb9928f5f151ddaaab5
Time: 2015-10-06
Author: cbj@mail.uni-paderborn.de
File Name: nt/speech_enhancement/mask_estimation.py
Class Name:
Method Name: simple_ideal_soft_mask


Project Name: scipy/scipy
Commit Name: 6f6513963c3f568e5ad985a17a4aee0192223935
Time: 2019-07-17
Author: pete.mahler.larsen@gmail.com
File Name: scipy/spatial/_spherical_voronoi.py
Class Name: SphericalVoronoi
Method Name: _calc_vertices_regions