diff options
author | Soumith Chintala <soumith@gmail.com> | 2015-07-31 18:58:59 +0300 |
---|---|---|
committer | Soumith Chintala <soumith@gmail.com> | 2015-07-31 18:58:59 +0300 |
commit | 84df43bbabd7f5330dccfa058c37b404d0cd85bf (patch) | |
tree | e2343782126bcc36ed3731d63b2020e867a15999 | |
parent | 4b880a6a74a84c164fb3e67c588b837f1babce44 (diff) | |
parent | b7b4a1558418d5999b9149f3e4dfdff27a6fa773 (diff) |
Merge pull request #339 from torch/singletondim
fixing corner-case of last dimension in addSingletonDimension
-rw-r--r-- | utils.lua | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -68,7 +68,8 @@ end function nn.utils.addSingletonDimension(t, dim) assert(torch.isTensor(t), "input tensor expected") local dim = dim or 1 - assert(dim > 0 and dim <= t:dim(), "invalid dimension: " .. dim) + assert(dim > 0 and dim <= (t:dim() + 1), "invalid dimension: " .. dim + .. '. Tensor is of ' .. t:dim() .. ' dimensions.') local view = t.new() local size = torch.LongStorage(t:dim() + 1) |