e21ef336207b0f9ae378c77430d298945827830a,art/classifiers/pytorch.py,PyTorchClassifier,get_activations,#PyTorchClassifier#Any#Any#Any#,338

Before Change


        else:
            raise TypeError("Layer must be of type str or int")

        return model_outputs[layer_index].detach().cpu().numpy()

    def set_learning_phase(self, train):
        
        Set the learning phase for the backend framework.

After Change


        num_batch = int(np.ceil(len(x_) / float(batch_size)))
        for m in range(num_batch):
            // Batch indexes
            begin, end = m * batch_size, min((m + 1) * batch_size, x_.shape[0])

            // Run prediction for the current batch
            layer_output = self._model(torch.from_numpy(x_[begin:end]).to(self._device).float())[layer_index]
            results.append(layer_output.detach().cpu().numpy())
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: e21ef336207b0f9ae378c77430d298945827830a
Time: 2019-02-12
Author: M.N.Tran@ibm.com
File Name: art/classifiers/pytorch.py
Class Name: PyTorchClassifier
Method Name: get_activations


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: a922855fe7aef360e4a360caa800388d9c843355
Time: 2019-07-23
Author: beat.buesser@ie.ibm.com
File Name: art/classifiers/tensorflow.py
Class Name: TensorflowV2Classifier
Method Name: predict


Project Name: rusty1s/pytorch_geometric
Commit Name: 5ffa38fca42bb3fbee030f4b80264e0f4910a49c
Time: 2018-01-16
Author: matthias.fey@tu-dortmund.de
File Name: torch_geometric/datasets/utils/tu_format.py
Class Name:
Method Name: read_adj