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

Test step to handle non-scalar outputs #4609

Closed
murnanedaniel opened this issue Nov 10, 2020 · 1 comment
Closed

Test step to handle non-scalar outputs #4609

murnanedaniel opened this issue Nov 10, 2020 · 1 comment
Labels
feature Is an improvement or enhancement help wanted Open to be worked on won't fix This will not be worked on

Comments

@murnanedaniel
Copy link

🚀 Feature

Handle output from test loop not being a single value.

Motivation

I often need to use a callback to do some processing on test values (to make plots, etc.), which I like to separate from the core module code. In this case, I would like to use on_test_batch_end to build a list of predicted values, calculated in the core test_step.

Pitch

To make this work, I need to output an object from test_step, something like {"loss": loss, "predictions": preds, "truth": truth}. However, the test loop runs .item() on any torch tensors, which doesn't work if the outputs are non-scalar. It would be cool if the test loop handled this situation, otherwise the output from test loop (and therefore any inputs to callbacks) is limited to scalar tensors.

@murnanedaniel murnanedaniel added feature Is an improvement or enhancement help wanted Open to be worked on labels Nov 10, 2020
@stale
Copy link

stale bot commented Dec 20, 2020

This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team!

@stale stale bot added the won't fix This will not be worked on label Dec 20, 2020
@stale stale bot closed this as completed Dec 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement help wanted Open to be worked on won't fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants