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

fix: RuntimeError: result type Float can't be cast to the desired output type long int #271

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ItzDerock
Copy link

This PR re-implements the patch done in ultralytics/yolov5 pr 8067 to fix this error when using torch 1.12

reimplements ultralytics/yolov5 pr #88067
RuntimeError: result type Float can't be cast to the desired output type long int
@ItzDerock
Copy link
Author

fixes #270

@RainYQ
Copy link

RainYQ commented Dec 7, 2022

for torch == 1.13.0

just fix it

utils/loss.py

-> 130
gain = torch.ones(6, device=targets.device, dtype=torch.long) # normalized to gridspace gain
-> 138
gain[2:] = torch.tensor(p[i].shape, dtype=torch.long)[[3, 2, 3, 2]] # xyxy gain
-> 144
at = torch.arange(na, device=targets.device).view(na, 1).repeat(1, nt) # anchor tensor, same as .repeat_interleave(nt)

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

Successfully merging this pull request may close these issues.

None yet

2 participants