火炬 - 分数最大池(fmp)问题

时间:2016-01-20 20:23:43

标签: lua neural-network torch

我坚持在火炬中实施多个最大分数池。源代码如下;

https://github.com/torch/nn/blob/master/SpatialFractionalMaxPooling.lua

我可以使用以下模型(这是模型中的火炬打印);

nn.Sequential {
  [input -> (1) -> (2) -> (3) -> (4) -> (5) -> (6) -> output]
  (1): nn.SpatialConvolutionMM(3 -> 96, 3x3, 1,1, 1,1)
  (2): nn.Tanh
  (3): nn.SpatialFractionalMaxPooling(0,0,2,2)
  (4): nn.View
  (5): nn.Linear(42336 -> 10)
  (6): nn.SoftMax
}

一旦我添加了更多的conv / fmp图层,我就得到了;

...install/share/lua/5.1/nn/SpatialFractionalMaxPooling.lua:134: bad argument #3 to 'SpatialFractionalMaxPooling_updateGradInput' (gradOutput height unexpected)
stack traceback:
        [C]: in function 'SpatialFractionalMaxPooling_updateGradInput'
        ...install/share/lua/5.1/nn/SpatialFractionalMaxPooling.lua:134: in function 'updateGradInput'
        /home/msmith/torch/install/share/lua/5.1/nn/Module.lua:30: in function 'backward'
        /home/msmith/torch/install/share/lua/5.1/nn/Sequential.lua:84: in function 'backward'
        train.lua:54: in function 'opfunc'
        /home/msmith/torch/install/share/lua/5.1/optim/adam.lua:33: in function 'optimMethod'
        train.lua:61: in function 'training'
        main.lua:109: in function 'op'
        [string "_RESULT={op()}"]:1: in main chunk
        [C]: in function 'xpcall'
        /home/msmith/torch/install/share/lua/5.1/trepl/init.lua:630: in function 'repl'
        ...mith/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:187: in main chunk
        [C]: at 0x00406670

0 个答案:

没有答案