Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use latent variables to achieve downstream tasks #144

Open
735422713 opened this issue May 17, 2024 · 1 comment
Open

How to use latent variables to achieve downstream tasks #144

735422713 opened this issue May 17, 2024 · 1 comment

Comments

@735422713
Copy link

Hello. I'm having some trouble.
I've implemented training and testing with custom data, but I want to extract latent variables so that I can implement relevant downstream tasks such as classification, regression, etc.
Can you give me some advice on how to extract latent variables?
Thanks!!!

@clementchadebec
Copy link
Owner

Hello, sorry for the late reply.

You can use the embed method to get the corresponding latent variables.

def embed(self, inputs: torch.Tensor) -> torch.Tensor:
"""Return the embeddings of the input data.
Args:
inputs (torch.Tensor): The input data to be embedded, of shape [B x input_dim].
Returns:
torch.Tensor: A tensor of shape [B x latent_dim] containing the embeddings.
"""
return self(DatasetOutput(data=inputs)).z

I hope this helps.

Best,

Clément

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

No branches or pull requests

2 participants