Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using nn.PReLU with Sequencer leads to SegFault on CPU or cuda runtime error (77) on GPU #405

Open
spurra opened this issue Mar 16, 2017 · 0 comments

Comments

@spurra
Copy link

spurra commented Mar 16, 2017

I've been playing around with the RNN library and got the following code:

cnn = nn.Sequential()

-- Creates a conv_block: [SpatConv, SpatMaxPool, PReLU, Dropout]
function add_conv_block(model, nFilterIn, nFilterOut, filterH, filterW, dOut, 
    preluLeak)  
    dOut = dOut or default_dropout
    preluLeak = preluLeak or default_preluLeak
    return model:add(nn.SpatialConvolution(nFilterIn, nFilterOut, filterW, 
        filterH))
        :add(nn.SpatialBatchNormalization(nFilterOut))
        :add(nn.SpatialDropout(dOut))
        :add(nn.PReLU(preluLeak))
end


cnn:add(nn.Reshape(1,8,24))
add_conv_block(cnn, 1, 32, 2,6)
cnn:add(nn.Reshape(4256))
cnn:add(nn.Linear(4256, 2048))
-------------------------------------------------------

-- Construct the complete model

model = nn.Sequencer(
	nn.Sequential()
		:add(cnn)
	)

model:cuda()

-------------------------------------------------------

-- Test with dummy input
x = torch.CudaTensor(10, 128, 192)

y = model:forward(x)

Running this on CPU gives me a segmentation fault. Running it on the GPU gives me the following error: cuda runtime error (77) : an illegal memory access was encountered.

After iteratively leaving out parts of the architecture, I found the culprit: nn.PReLU. Uncommenting it leads to normal behaviour. I've replaced it with LeakyReLU, which works fine. I'd like to report this issue in case it can be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant