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

RuntimeError: view size is not compatible with input tensor's size and stride #553

Open
mikel-brostrom opened this issue Jan 31, 2023 · 1 comment

Comments

@mikel-brostrom
Copy link

mikel-brostrom commented Jan 31, 2023

Got this error:

File "train.py", line 211, in build_target
    pred_ious = bboxes_iou(pred[b].view(-1, 4), truth_box, xyxy=False)
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.

Solved it by changing view:

pred_ious = bboxes_iou(pred[b].view(-1, 4), truth_box, xyxy=False)

to reshape

patches11 pushed a commit to Blyncs/yolov4 that referenced this issue Feb 13, 2023
@J1ia
Copy link

J1ia commented Feb 25, 2023

在view前面加.contiguous()

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