Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

fix slow concat #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

YingtianDt
Copy link

In the original activations/core.py: ActivationsHelper._get_activations_batched, the np.concatenate for accumulating output features will drastically slow down the program (as the accumulated result becomes larger). Now I fix it by simply using list to keep track of all outputs and concatenate them at the very end.

Copy link
Member

@mschrimpf mschrimpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move import to top, otherwise looks good

@@ -126,19 +126,20 @@ def register_stimulus_set_hook(self, hook):
return handle

def _get_activations_batched(self, paths, layers, batch_size):
layer_activations = None
from collections import OrderedDict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep imports at the top of the file

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants