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

view size is not compatible with input tensor for sgdet #9

Closed
Harryqu123 opened this issue Sep 16, 2021 · 2 comments
Closed

view size is not compatible with input tensor for sgdet #9

Harryqu123 opened this issue Sep 16, 2021 · 2 comments

Comments

@Harryqu123
Copy link

Harryqu123 commented Sep 16, 2021

Hi, thanks for your code and paper in advance.
However, I have a small question.
When I run the training code in predcls or sgcls mode, everything is fine but when I run the training code in sgdet mode, the error below shows:

File "/home/quhaoxuan/STTran/fasterRCNN/lib/model/rpn/rpn.py", line 50, in reshape
x = x.view(
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

I understand that this function seems to be only triggered in sgdet setting.
But can I ask is there any suggestions on any possible solutions to this error?
Many thanks in advance

@yrcong
Copy link
Owner

yrcong commented Sep 17, 2021

Hi,
i have never seen this before. Could you give some more information. Is this triggered in the training or test? How the Tensor x really look like? Which pytorch version are you using?
If your pytorch=1.1.0, the issue may be not caused by view function, but somewhere else.

@Harryqu123
Copy link
Author

Thanks for your reply.
It happens in the training process of sgdet and my pytorch version is 1.8.0 so I guess it is not the issue for pytorch 1.1.0
However, I find that if I simply change the view function there to reshape function in fasterRCNN/lib/model/rpn/rpn.py, and change the tensor in lib/object_detector.py in line 143 and 148 from CPU tensor to cuda tensor, I can run the code of sgdet.
I am not sure whether this would affect the performance but I think I will close this comment first as I somehow solve the issue already.
Many thanks

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

2 participants