Cannot use FireModule with CUDA
jonathanasdf opened this issue · comments
gradParameters becomes nan.
Of course, if I just use the constituent layers and build my own FireModule function like:
function FireModule(nInputPlane, s1x1, e1x1, e3x3)
local module = nn.Sequential()
module:add(nn.SpatialConvolution(nInputPlane, s1x1, 1, 1)):add(nn.ReLU(true))
local expand = nn.Concat(2)
expand:add(nn.SpatialConvolution(s1x1, e1x1, 1, 1))
expand:add(nn.SpatialConvolution(s1x1, e3x3, 3, 3, 1, 1, 1, 1))
module:add(expand):add(nn.ReLU(true))
return module
end
model:add(FireModule(a,b,c,d))
then everything works fine, but then I don't get the neat __tostring__
.
Is there any way of fixing this from your side? Thanks
@sagarwaghmare69 Could you look into this when you have time?
@jonathanasdf I am not able to reproduce the error. Can you please provide your code snippet ?
Yes.
On Fri, Mar 11, 2016 at 3:37 PM, Nicholas Léonard notifications@github.com
wrote:
@sagarwaghmare69 https://github.com/sagarwaghmare69 Could you look into
this when you have time?—
Reply to this email directly or view it on GitHub
#45 (comment)
.
Apparently it randomly becomes 0, inf, or nan. Also, zeroGradParameters doesn't seem to do anything.
require 'dpnn'
require 'cutorch'
local m = nn.Sequential()
m:add(nn.FireModule(1,1,1,1))
_, p = m:getParameters()
print(p:sum())
m = m:cuda()
_, p = m:getParameters()
print(p:sum())
m:zeroGradParameters()
print(p:sum())
Some outputs (randomly one of these)
-1.5261873854701e+236
nan
nan
1.117789947961e+138
inf
inf
4.8518308672707e-309
0
0
@jonathanasdf Thanks for reporting the bug and providing an example. I was able to reproduce the bug. We will fix it (latest by Monday evening). Thanks.
@jonathanasdf fixed via #46 . Thanks @sagarwaghmare69
Thank you for the fast fix!