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

IndexError: tensors used as indices must be long, byte or bool tensors #335

Open
alirazaanis-inteon opened this issue Jul 6, 2022 · 0 comments

Comments

@alirazaanis-inteon
Copy link

Error at line https://github.com/NVIDIA/retinanet-examples/blob/main/odtk/box.py#L299

291 classes = (indices / width / height) % num_classes
292 classes = classes.type(all_cls_head.type())
293
294 # Infer kept bboxes
295 x = indices % width
296 y = (indices / width) % height
297 a = indices / num_classes / height / width
298 box_head = box_head.view(num_anchors, num_boxes, height, width)
299 boxes = box_head[a, :, y, x] ---------------------------------------------------------> IndexError

use '//' instead of '/' to fix the issue, fixed code below;

291 classes = (indices // width // height) % num_classes
292 classes = classes.type(all_cls_head.type())
293
294 # Infer kept bboxes
295 x = indices % width
296 y = (indices // width) % height
297 a = indices // num_classes // height // width
298 box_head = box_head.view(num_anchors, num_boxes, height, width)
299 boxes = box_head[a, :, y, x]

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