Skip to content

Commit b8607cf

Browse files
f4strbeat-buesser
authored andcommitted
Revert "remove huggingface estimator activation hack"
This reverts commit 4db7626. Signed-off-by: Farhan Ahmed <[email protected]>
1 parent 47801a7 commit b8607cf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

art/estimators/classification/hugging_face.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,11 @@ def get_activations( # type: ignore
324324
def get_feature(name):
325325
# the hook signature
326326
def hook(model, input, output): # pylint: disable=W0622,W0613
327-
self._features[name] = output
327+
# TODO: this is using the input, rather than the output, to circumvent the fact
328+
# TODO: that flatten is not a layer in pytorch, and the activation defence expects
329+
# TODO: a flattened input. A better option is to refactor the activation defence
330+
# TODO: to not crash if non 2D inputs are provided.
331+
self._features[name] = input
328332

329333
return hook
330334

0 commit comments

Comments
 (0)