diff --git a/SpatialAveragePooling.lua b/SpatialAveragePooling.lua index 90b79aaad..88603a7a1 100644 --- a/SpatialAveragePooling.lua +++ b/SpatialAveragePooling.lua @@ -30,3 +30,8 @@ function SpatialAveragePooling:updateGradInput(input, gradOutput) return self.gradInput end end + +function SpatialAveragePooling:__tostring__() + return string.format('%s(%d,%d,%d,%d)', torch.type(self), + self.kW, self.kH, self.dW, self.dH) +end diff --git a/SpatialConvolution.lua b/SpatialConvolution.lua index c5fce40cb..3507030c4 100644 --- a/SpatialConvolution.lua +++ b/SpatialConvolution.lua @@ -121,13 +121,15 @@ function SpatialConvolution:type(type) end function SpatialConvolution:__tostring__() - local s = string.format('%s(in: %d, out: %d, kW: %d, kH: %d', torch.type(self), + local s = string.format('%s(%d -> %d, %dx%d', torch.type(self), self.nInputPlane, self.nOutputPlane, self.kW, self.kH) if self.dW ~= 1 or self.dH ~= 1 then - s = s .. string.format(', dW: %d, dH: %d', self.dW, self.dH) + s = s .. string.format(', %d,%d', self.dW, self.dH) end - if self.padding ~= 0 then - s = s .. ', padding: ' .. self.padding + if self.padding and self.padding ~= 0 then + s = s .. ', ' .. self.padding .. ',' .. self.padding + elseif self.pad_w or self.pad_h then + s = s .. ', ' .. self.pad_w .. ',' .. self.pad_h end return s .. ')' end diff --git a/SpatialConvolutionMM.lua b/SpatialConvolutionMM.lua index e9352573b..a006dc33f 100644 --- a/SpatialConvolutionMM.lua +++ b/SpatialConvolutionMM.lua @@ -85,13 +85,15 @@ function SpatialConvolutionMM:type(type) end function SpatialConvolutionMM:__tostring__() - local s = string.format('%s(in: %d, out: %d, kW: %d, kH: %d', torch.type(self), + local s = string.format('%s(%d -> %d, %dx%d', torch.type(self), self.nInputPlane, self.nOutputPlane, self.kW, self.kH) if self.dW ~= 1 or self.dH ~= 1 then - s = s .. string.format(', dW: %d, dH: %d', self.dW, self.dH) + s = s .. string.format(', %d,%d', self.dW, self.dH) end - if self.padding ~= 0 then - s = s .. ', padding: ' .. self.padding + if self.padding and self.padding ~= 0 then + s = s .. ', ' .. self.padding .. ',' .. self.padding + elseif self.pad_w or self.pad_h then + s = s .. ', ' .. self.pad_w .. ',' .. self.pad_h end return s .. ')' end diff --git a/SpatialMaxPooling.lua b/SpatialMaxPooling.lua index de5110869..7be85d54d 100644 --- a/SpatialMaxPooling.lua +++ b/SpatialMaxPooling.lua @@ -34,6 +34,6 @@ function SpatialMaxPooling:empty() end function SpatialMaxPooling:__tostring__() - return string.format('%s(kW: %d, kH: %d, dW: %d, dH: %d)', torch.type(self), + return string.format('%s(%d,%d,%d,%d)', torch.type(self), self.kW, self.kH, self.dW, self.dH) end