diff options
author | Julien Cornebise <jucor@google.com> | 2015-02-20 20:07:22 +0300 |
---|---|---|
committer | Julien Cornebise <jucor@google.com> | 2015-02-20 20:07:22 +0300 |
commit | 65fd3b6f53920d503a8ab2180595a438a84d6079 (patch) | |
tree | a5a0c7b97fd2d08bfd8ff67feae55beaa3b9a397 | |
parent | 8122c997ff4010238d125633236ffe62258f7de7 (diff) |
Revert "toDisplayTensor : input is only copied when necessary"
This reverts commit 3bc649ac0258936dfc67e5de8320faed649b6bf8.
Conflicts:
init.lua
-rwxr-xr-x | init.lua | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -986,19 +986,19 @@ local function toDisplayTensor(...) {arg='saturate', type='boolean', help='saturate (useful when min/max are lower than actual min/max', default=true} ) - local packed + local packed = torch.Tensor() if type(input) == 'table' then -- pack images in single tensor local ndims = input[1]:dim() local channels = ((ndims == 2) and 1) or input[1]:size(1) local height = input[1]:size(ndims-1) local width = input[1]:size(ndims) - packed = torch.Tensor(#input,channels,height,width) + packed:resize(#input,channels,height,width) for i,img in ipairs(input) do packed[i]:copy(input[i]) end else - packed = torch.Tensor(input:size()):copy(input) + packed:resize(input:size()):copy(input) end -- scale each |