78ee3d8532b2ec5522cce205c7221be15810ba4a,allennlp/interpret/saliency_interpreters/smooth_gradient.py,SmoothGradient,_register_forward_hook,#SmoothGradient#Any#,47
Before Change
// Register the hook
handle = None
for module in self.predictor._model.modules():
if isinstance(module, TextFieldEmbedder):
handle = module.register_forward_hook(forward_hook)
return handle
def _smooth_grads(self, instance: Instance) -> Dict[str, numpy.ndarray]:
total_gradients: Dict[str, Any] = {}
After Change
output.add_(noise)
// Register the hook
embedding_layer = util.find_embedding_layer(self.predictor._model)
handle = embedding_layer.register_forward_hook(forward_hook)
return handle
def _smooth_grads(self, instance: Instance) -> Dict[str, numpy.ndarray]:
total_gradients: Dict[str, Any] = {}
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances
Project Name: allenai/allennlp
Commit Name: 78ee3d8532b2ec5522cce205c7221be15810ba4a
Time: 2019-08-29
Author: mattg@allenai.org
File Name: allennlp/interpret/saliency_interpreters/smooth_gradient.py
Class Name: SmoothGradient
Method Name: _register_forward_hook
Project Name: allenai/allennlp
Commit Name: 78ee3d8532b2ec5522cce205c7221be15810ba4a
Time: 2019-08-29
Author: mattg@allenai.org
File Name: allennlp/interpret/saliency_interpreters/integrated_gradient.py
Class Name: IntegratedGradient
Method Name: _register_forward_hook
Project Name: allenai/allennlp
Commit Name: 78ee3d8532b2ec5522cce205c7221be15810ba4a
Time: 2019-08-29
Author: mattg@allenai.org
File Name: allennlp/interpret/saliency_interpreters/simple_gradient.py
Class Name: SimpleGradient
Method Name: _register_forward_hook