9b9a42de05056b418f98e3635f2cffd747123548,art/classifiers/pytorch.py,PyTorchClassifier,loss_gradient,#PyTorchClassifier#Any#Any#,136
Before Change
:rtype: `np.ndarray`
// Check if loss available
if not hasattr(self, "_loss_grads") or self._loss_grads is None:
raise ValueError("Need the loss function to compute the loss gradient.")
// Compute the gradient and return
grds = self._sess.run(self._loss_grads, feed_dict={self._input_ph: inputs, self._output_ph: labels})
return grds
def _forward_at(self, inputs, layer):
After Change
// Compute the gradient and return
loss = self._loss(m_batch, o_batch)
loss.backward()
return grds
def _forward_at(self, inputs, layer):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 9b9a42de05056b418f98e3635f2cffd747123548
Time: 2018-05-16
Author: M.N.Tran@ibm.com
File Name: art/classifiers/pytorch.py
Class Name: PyTorchClassifier
Method Name: loss_gradient
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 9b9a42de05056b418f98e3635f2cffd747123548
Time: 2018-05-16
Author: M.N.Tran@ibm.com
File Name: art/classifiers/pytorch.py
Class Name: PyTorchClassifier
Method Name: class_gradient
Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 64764718080b11c8fb91df34c12e0ce8ac54aa4e
Time: 2018-05-15
Author: M.N.Tran@ibm.com
File Name: art/classifiers/pytorch.py
Class Name: PyTorchClassifier
Method Name: fit