torch/nn — pull request #70 by bpiwowar (2014-09-19 09:27:56+00:00)
Title: BatchReshape module

The reshape module does not allow to cope with the output of e.g. temporal convolution. For example, if I have a batch of size 25, and 50 output frames of dimension 10 that I would like to process through a linear module, there is no way to do so currently. With BatchReshape, this gives

```
> print(nn.BatchReshape(1, 50, 10):forward(torch.randn(25, 50, 10)):size())

1250
10
[torch.LongStorage of size 2]
```

we can then process them using any module that operate on batches with matrices, and then use it again to get back the initial batch:

```
> print(nn.BatchReshape(1, 1, 50, 10):forward(torch.randn(1250, 10)):size())

25
50
10
[torch.LongStorage of size 3]
```