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

Dimension cannot match #3

Open
Janetalready opened this issue Mar 1, 2021 · 0 comments
Open

Dimension cannot match #3

Janetalready opened this issue Mar 1, 2021 · 0 comments

Comments

@Janetalready
Copy link

Hi, I tried to run train.py but got this error.

Traceback (most recent call last):
File "/home/shuwen/projects/strokenet/train.py", line 184, in
train_agent_mnist('./model/gen.pkl', './model/mnist_agent.pkl')
File "/home/shuwen/projects/strokenet/train.py", line 113, in train_agent_mnist
loss = MSE(images, approx) + penalty * LAMBDA
RuntimeError: The size of tensor a (256) must match the size of tensor b (3) at non-singleton dimension 3

It seems that MSE(images, approx) returns a shape (batch_size, 1, 256, 256) and penalty returns a shape (batch_size, 15, 3).

When I removed the arguments here MSE = torch.nn.MSELoss(reduce=False, size_average=False).to(device) and changed it to MSE = torch.nn.MSELoss().to(device), the output is just a dot. Any idea how to fix it?

600_approx

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