Skip to content

Default Tensor type fix #32

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

Merged
merged 2 commits into from
Dec 18, 2016
Merged

Default Tensor type fix #32

merged 2 commits into from
Dec 18, 2016

Conversation

ili3p
Copy link
Contributor

@ili3p ili3p commented Sep 27, 2016

There is a bug if you set the default tensor type to CudaTensor. For example:

 local display   = require 'display'
torch.setdefaulttensortype('torch.CudaTensor')

-- then call
display.image(torch.randn(16, 3, 32, 32)

The display.image would call image.compressJPG(img) which in turns calls image.clampImage(..). There, these two lines cause problem:
init.lua165: from image package

local a = torch.Tensor():resize(tensor:size()):copy(tensor)
a.image.saturate(a) -- bound btwn 0 and 1

Here a is a default type tensor and if that is set to CudaTensor it won't have the field image.

This PR is fixing the bug by setting the default tensor type to DoubleTensor and then restoring to the original state.

@ili3p
Copy link
Contributor Author

ili3p commented Sep 27, 2016

I have also changed the image button to a bolder arrow and add the image button only to ImagePanes.

@szym szym merged commit 7de58ef into szym:master Dec 18, 2016
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.

2 participants