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):
After Change
// Run prediction with batch processing
results = []
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())
results = np.vstack(results)
return results
In pattern: SUPERPATTERN
Frequency: 4
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: maciejkula/spotlight
Commit Name: bed4f2dd50ff54eb7629362c3d03a3b758e0745a
Time: 2017-08-09
Author: maciej.kula@gmail.com
File Name: spotlight/layers.py
Class Name: BloomEmbedding
Method Name: forward
Project Name: pytorch/pytorch
Commit Name: a0cf5566d88533c5caa7a490beb6eb0760eee9b4
Time: 2021-01-21
Author: wanchaol@users.noreply.github.com
File Name: torch/optim/sgd.py
Class Name: SGD
Method Name: step
Project Name: BindsNET/bindsnet
Commit Name: fffdd5f44765bcdde925e5a10d7e12ec59f7cfaf
Time: 2019-02-22
Author: danjsaund@gmail.com
File Name: bindsnet/analysis/plotting.py
Class Name:
Method Name: plot_voltages