bad argument #1 to '?' (empty tensor) in cudnn.Relu

16 views
Skip to first unread message

Mata Fu

unread,
Mar 7, 2018, 7:57:14 PM3/7/18
to torch7
I designed a network like this 

training net
nn.Sequential {
 
[input -> (1) -> (2) -> (3) -> (4) -> (5) -> (6) -> output]
 
(1): cudnn.SpatialConvolution(1 -> 112, 3x3)
 
(2): cudnn.ReLU
 
(3): nn.ConcatTable {
    input
     
|`-> (1): nn.Sequential {
      |      [input -> (1) -> (2) -> output]
      |      (1): cudnn.SpatialConvolution(112 -> 112, 3x3)
      |      (2): cudnn.ReLU
      |    }
       `
-> (2): nn.SpatialMaxPooling(7x7)
       
... -> output
 
}


testing net (keeping the same size of the image while extracting features)
nn.Sequential {
 
[input -> (1) -> (2) -> (3) -> (4) -> (5) -> (6) -> output]
 
(1): cudnn.SpatialConvolution(1 -> 112, 3x3, 1,1, 1,1)
 
(2): cudnn.ReLU
 
(3): nn.ConcatTable {
    input
     
|`-> (1): nn.Sequential {
      |      [input -> (1) -> (2) -> output]
      |      (1): cudnn.SpatialConvolution(112 -> 112, 3x3, 1,1, 1,1)
      |      (2): cudnn.ReLU
      |    }
       `
-> (2): nn.SpatialMaxPooling(7x7, 1,1, 3,3)
       
... -> output
 
}


Training it in patches and test it on the entire images (fully convolutional network)

During training everything is ok. But while testing I got an error



luajit
: /home/x/torch/install/share/lua/5.1/nn/Container.lua:70:
In 3 module of nn.Sequential:
bad argument
#1 to '?' (empty tensor)
stack traceback
:
       
[C]: at 0x7f47002de0e0
       
[C]: in function '__newindex'
       
/home/x/torch/install/share/lua/5.1/nn/ConcatTable.lua:13: in function </home/x/torch/install/share/lua/5.1/nn/ConcatTable.lua:9>
       
[C]: in function 'xpcall'
       
/home/x/torch/install/share/lua/5.1/nn/Container.lua:66: in function 'rethrowErrors'
       
/home/x/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward'
       
/home/x/torch/install/share/lua/5.1/optnet/init.lua:387: in function 'optimizeMemory'
       
./main.lua:1933: in function 'stereo_predict'
       
./main.lua:2181: in main chunk
       
[C]: at 0x00405e40


WARNING
: If you see a stack trace below, it doesn't point to the place where this error occurred. Please use only the one above.
stack traceback:
        [C]: in function '
error'
        /home/x/torch/install/share/lua/5.1/nn/Container.lua:70: in function '
rethrowErrors'
        /home/x/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function '
forward'
        /home/x/torch/install/share/lua/5.1/optnet/init.lua:387: in function '
optimizeMemory'
        ./main.lua:1933: in function '
stereo_predict'
        ./main.lua:2181: in main chunk
        [C]: at 0x00405e40


After debuging, I found the error is related to the 2nd cudnn.ReLU, But still don't know why?
Could someone help me ?


Mata Fu

unread,
Mar 8, 2018, 5:52:57 AM3/8/18
to torch7
Is that possible that this problem is caused by the inplace operation of nn.ReLU()?

在 2018年3月8日星期四 UTC+1上午1:57:14,Mata Fu写道:
Reply all
Reply to author
Forward
0 new messages