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

Problem about stitching/branch_train.py. #33

Closed
SpiritBear000 opened this issue Oct 14, 2018 · 4 comments
Closed

Problem about stitching/branch_train.py. #33

SpiritBear000 opened this issue Oct 14, 2018 · 4 comments

Comments

@SpiritBear000
Copy link

At [https://github.com/penincillin/DREAM/blob/7bea01e5b108546a2b3a809ad17cf478607c9db5/src/stitching/branch_train.py#L52]

when i run this code, i get this error:

Traceback (most recent call last):
File "/media/lab210/Work/WH_HOME/SubjectDownload/Project/Face-reid/[ DREAM-Face ]/DREAM/src/stitching/branch_train.py", line 134, in
main()
File "/media/lab210/Work/WH_HOME/SubjectDownload/Project/Face-reid/[ DREAM-Face ]/DREAM/src/stitching/branch_train.py", line 52, in main
losses.update(loss.data[0], loss.size(0))
RuntimeError: dimension specified as 0 but tensor has no dimensions

when i replace 'loss' to 'loss.size(0)'. the code can run. is it a bug when you design your code?

@tataganesh95
Copy link

Could be because of this - hunkim/PyTorchZeroToAll#24

@SpiritBear000
Copy link
Author

Could be because of this - hunkim/PyTorchZeroToAll#24

thank you! There is another question to ask.

In

loss = criterion(output, batch_target_feat)

The output of MSEloss is a scalar,why a scalar have '.size()'?

And i am confused about the function 'AverageMeter' which is in (

def update(self, val, n=1):
)
what's the meaning of 'n' in AverageMeter.update?

@penincillin
Copy link
Owner

Thanks for asking,
This issue might be caused by the version of Pytorch.
This code is developed with Pytorch 0.3 and might be not compatible with Pytorch 0.4.
As for the bug you report, I believe it is not a tough one, you could try to solve by yourself :)

@clhne
Copy link

clhne commented Apr 10, 2020

@SpiritBear000
Just modify the code:
losses.update(loss.data[0], loss.size(0))
to
losses.update(loss.data, loss)
Then run it.

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

4 participants