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: "clamp_cpu" not implemented for 'Half' #8

Closed
mayankcstech opened this issue Mar 29, 2020 · 3 comments
Closed

RuntimeError: "clamp_cpu" not implemented for 'Half' #8

mayankcstech opened this issue Mar 29, 2020 · 3 comments

Comments

@mayankcstech
Copy link

mayankcstech commented Mar 29, 2020

Hi

I have just started implementing it. Trying to run the code "object_detection.py" for a video. I am able to read the video, resize it, as is inside the code. Although I am getting the following error:

Traceback (most recent call last): File "object_detection.py", line 141, in <module> ObjectDetection(id).main() File "object_detection.py", line 110, in main output[:,1:5] = torch.clamp(output[:,1:5], 0.0, float(self.inp_dim))/self.inp_dim RuntimeError: "clamp_cpu" not implemented for 'Half'

When I commented out the line

output = output.type(torch.half)

it works and does detection. But I am not sure if that's the right way to resolve the error. Please guide as what would be the issue. Thanks!

@paul-pias
Copy link
Owner

Which Pytorch Version you are using?

@mayankcstech
Copy link
Author

Hi,

I am using pytorch 1.4.0 on python 3.7. Thanks!

@paul-pias
Copy link
Owner

There is no error in my side. However, the type of the data was converted to float16 from float32 to speed up the execution time. If you are still facing the issue change torch.half to torch.float in line 104. Kindly let me know if it solves your issue.

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