Skip to content

Support attention layer (mlp) #76

@kencan7749

Description

@kencan7749

features: Dict[str, _tensor_t] = {

I'd like to use this feature extractor for standard ViT (CLIP) model. I found that the naive output of attention layer is tuple shape (activation, None). Since this feature extractor is also used in icnn.py, it will raise error when we perform reconstruction analysis using attention layer. One way to avoid this issue is just selecting the first element when the output is a tuple.

if type(output) is tuple:
   features[layer] = output[0]
else:
   features[layer] = output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions