You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a regression based modelling repository where the predictions can be multi-output or single-output based on configuration. My network outputs [n_samples, n_tasks] where n_task varies according to the task. If n_task is 1 then trying, torchmetrics.functional.pearson_corrcoef(predictions, targets) gives the error,
ValueError: Expected argument `num_outputs` to match the second dimension of input, but got 1 and 1
Changing the output shape for a single task specifically just so as to fit the metric function does not seem like a good solution. I think a simple change should be able to fix it.
My current workout around,
importtorchmetrics.functionalasFm# predictions are [n, 1] for single task/outputFm.pearson_corrcoef(predictions, targets) ifpredictions.shape[1] >1elseFm.pearson_corrcoef(predictions[:, 0], targets[:, 0])
🐛 Bug
I have a regression based modelling repository where the predictions can be multi-output or single-output based on configuration. My network outputs
[n_samples, n_tasks]
wheren_task
varies according to the task. Ifn_task
is 1 then trying,torchmetrics.functional.pearson_corrcoef(predictions, targets)
gives the error,ValueError: Expected argument `num_outputs` to match the second dimension of input, but got 1 and 1
Changing the output shape for a single task specifically just so as to fit the metric function does not seem like a good solution. I think a simple change should be able to fix it.
My current workout around,
There are other metrics that handle this,
To Reproduce
Steps to reproduce the behavior...
Code sample
Expected behavior
Environment
conda
,pip
, build from source):Additional context
The text was updated successfully, but these errors were encountered: