Skip to content

How to extract pre-classification-head feature embeddings for RealMLP? #38

@nearpit

Description

@nearpit

Question / Feature Request

Is there a supported way to extract feature embeddings from the layer immediately before the classification head?

Context

In the standalone version, this is straightforward using a forward hook:

model_.model_[-2].register_forward_hook(lambda x: ...)

However, I couldn't find an equivalent layer to attach a hook to in the new implementation.

I assume, it should be something like:

clf = clf = RealMLP_TD_Classifier()
layer = clf.alg_interface_.model.model ...
layer.register_forward_hook(lambda x: ...)

What I'm looking for

Either:

  • A pointer to the correct layer/module to hook into, or
  • A built-in API for extracting intermediate representations

Apologies if this is already documented somewhere and I missed it — happy to be pointed in the right direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions