Fixed an Error when training L2 and SSIM models #119
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I use translation software to write down the following information. If you have any questions, please point them out and I will explain them in more detail.
what I did
Fixed a BUG that caused Error when training L2 and SSIM models
the Error is
RuntimeError: Expected 3D (unbatched) or 4D (batched) input to conv2d, but got input of size: [5]
my env
I deployed LPIPS on the latest version of pytorch (and other packages).And I met this BUG.So I'm not sure if this BUG exists on the deployment of the original version.
how did this BUG appear
The error report occurred after the model forward function, when the value was introduced into the rank model forward function. After debug, I found that, unlike the LPIPS model, the size of the forward output Tensor of these two models is [1], not expected [1,1,1,1].
Combined with the prompt of error report, I think this should be the key to solving BUG.I reshape the Tensor and it works now.