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

Regression layer mismatch on train and test times #30

Open
evinpinar opened this issue Dec 30, 2020 · 2 comments
Open

Regression layer mismatch on train and test times #30

evinpinar opened this issue Dec 30, 2020 · 2 comments

Comments

@evinpinar
Copy link

It seems that while training, the regression prediction tensor is reshaped into [B, C, H, W]. Whereas in test time, only half of the output tensor is kept, resulting in [B, C/2, H, W] sized tensor. As in here
Is there a reason for that, or is it a bug?
I wish to calculate the validation loss, but it is not possible with the current setting. Should it be changed from:
ord_prob = F.softmax(x, dim=1)[:, 0, :, :, :]
to:
prob = F.log_softmax(x, dim=1).view(N, C, H, W) ?

@dontLoveBugs
Copy link
Owner

yes

@WBS-123
Copy link

WBS-123 commented Aug 8, 2022

It seems that while training, the regression prediction tensor is reshaped into [B, C, H, W]. Whereas in test time, only half of the output tensor is kept, resulting in [B, C/2, H, W] sized tensor. As in here Is there a reason for that, or is it a bug? I wish to calculate the validation loss, but it is not possible with the current setting. Should it be changed from: ord_prob = F.softmax(x, dim=1)[:, 0, :, :, :] to: prob = F.log_softmax(x, dim=1).view(N, C, H, W) ?

is that mean the code should be changed into:
prob = F.log_softmax(x, dim=1).view(N, C, H, W)
ord_label = torch.sum((prob > 0.5), dim=1)
return prob, ord_label
in other words,is that mean there is no need to distinguish between self.training and not self.training?

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

3 participants