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

Why using dummy data to calculate loss and update the meta model in MAML? #44

Open
Xiaohan-Chen opened this issue Feb 22, 2023 · 0 comments

Comments

@Xiaohan-Chen
Copy link

Thanks for sharing this few-shot learning repository, which help me a lot.

I am curious and confused why using dummy data to calculate loss and update the meta model in line 110 of file few_shot/maml.py, here I enclose the code:

# Dummy pass in order to create `loss` variable
# Replace dummy gradients with mean task gradients using hooks
logits = model(torch.zeros((k_way, ) + data_shape).to(device, dtype=torch.double))
loss = loss_fn(logits, create_nshot_task_label(k_way, 1).to(device))
loss.backward()
optimiser.step()

As I understand it, the test data should be applied to update the model, using dummy data to train the model seems unreasonable. I will be appreciated it if someone can answer this question.

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

1 participant