soumith/cuda-convnet2.torch — pull request #16 by adampolyak (2014-09-15 21:08:39+00:00)
Title: Allow filters to pass image size

Allow filters to pass image size. This is done by replacing math.floor with math.ceil - the same way it is in cuda convnet2.
The following code demonstrates the issue:
```lua
require 'nn'
require 'cunn'
require 'ccn2'

model = nn.Sequential()
model:add(ccn2.SpatialMaxPooling(3,2)) -- 4
model:cuda()

y = torch.rand(1,4,4,32):cuda()
print(model:forward(y):size())
```
Will output:
```shell
1
1
1
32
[torch.LongStorage of size 4]
````
This is also the case in nn.
In cuda-convnet2 however, the behaviour is different (in cuda-convnet2/layer.py):
```python
dic['modulesX'] = [1 + int(ceil((2*padding + imgSize - filterSize) / float(stride))) for # ... lines continues
```
and the size of the output tensor will be:
```shell
1
2
2
32
[torch.LongStorage of size 4]
````