Skip to content

Commit

Permalink
corrected a bug when displaying non-double tensors
Browse files Browse the repository at this point in the history
  • Loading branch information
koraykv committed Apr 11, 2012
1 parent f1d6f7d commit 86829ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion display.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ function fex.imToDisplay(x,params)
for i=1,#x do xx[i]:copy(x[i]) end
x=xx
end
if x:type() == 'torch.DoubleTensor' then
x=x:clone()
else
x=x:double()
end
if x:dim() == 2 then
x=torch.Tensor(x):resize(1,x:size(1),x:size(2))
end
Expand Down Expand Up @@ -66,7 +71,7 @@ function fex.imshow(im,params)
require 'qttorch'
params = params or {}
local title = params.title or "Image Display"
local xx = fex.imToDisplay(im:clone(),params)
local xx = fex.imToDisplay(im,params)
local wi,hi = xx:size(xx:dim()),xx:size(xx:dim()-1)
local ww = params.win or qtwidget.newwindow(wi,hi,title)
local xi = params.x or 0
Expand Down

0 comments on commit 86829ec

Please sign in to comment.