diff options
author | Boris Fomitchev <bfomitchev@nvidia.com> | 2016-08-30 04:47:56 +0300 |
---|---|---|
committer | Boris Fomitchev <bfomitchev@nvidia.com> | 2016-08-30 05:06:09 +0300 |
commit | 92ab959c6b15b9faf9c6ad0920852e84316aef57 (patch) | |
tree | 94b7671d3e5156f15a1fdbc4131ca982f1ff7fb7 /SpatialConvolution.lua | |
parent | 71586fb7f779f3a8666a50e6ae53075bea4e67b3 (diff) |
Addressed code review comments
Diffstat (limited to 'SpatialConvolution.lua')
-rw-r--r-- | SpatialConvolution.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/SpatialConvolution.lua b/SpatialConvolution.lua index bb5cf2f..f2ab112 100644 --- a/SpatialConvolution.lua +++ b/SpatialConvolution.lua @@ -89,22 +89,24 @@ end function SpatialConvolution:checkInputChanged(input) - assert(input:isContiguous()) - + assert(input:isContiguous(), + "input to " .. torch.type(self) .. " needs to be contiguous, but is non-contiguous") if not self.iSize or self.iSize:size() ~= input:dim() then self.iSize = torch.LongStorage(input:dim()):fill(0) end self.groups = self.groups or 1 if not self.weightDesc then self:resetWeightDescriptors() end + if not self.iDesc or not self.oDesc or input:size(1) ~= self.iSize[1] or input:size(2) ~= self.iSize[2] or input:size(3) ~= self.iSize[3] or input:size(4) ~= self.iSize[4] or (input:dim()==5 and input:size(5) ~= self.iSize[5]) then self.iSize = input:size() - - assert(self.nInputPlane == input:size(2), 'input has to contain: ' + assert(self.nInputPlane == input:size(2), + 'input has to contain: ' .. self.nInputPlane .. ' feature maps, but received input of size: ' - .. input:size(1) .. ' x ' .. input:size(2) .. - ' x ' .. input:size(3) .. ' x ' .. input:size(4)) + .. input:size(1) .. ' x ' .. input:size(2) .. ' x ' .. input:size(3) + .. (input:dim()>3 and ' x ' .. input:size(4) .. + (input:dim()==5 and ' x ' .. input:size(5) or '') or '')) return true end return false |