torch/nn — pull request #56 by nicholas-leonard (2014-07-25 17:38:52+00:00)
Title: SelectTable can resize

depends on https://github.com/torch/cutorch/pull/33

fixes #50

```lua
~/projects/nn$ th
> require 'nn'
true
[0.0150s]
> st = nn.SelectTable(1)
[0.0001s]
> input = {torch.rand(1)}
[0.0001s]
> gradOutput = torch.rand(1)
[0.0001s]
> st:forward(input)
0.7282
[torch.DoubleTensor of dimension 1]

[0.0001s]
> print(st:backward(input, gradOutput))
{
1 : DoubleTensor - size: 1
}
[0.0001s]
> input = {torch.rand(1), torch.rand(1)}
[0.0001s]
> print(st:backward(input, gradOutput))
{
1 : DoubleTensor - size: 1
2 : DoubleTensor - size: 1
}
[0.0003s]
> input = {torch.rand(1), torch.rand(1,2), torch.rand(1)}
[0.0003s]
> print(st:backward(input, gradOutput))
{
1 : DoubleTensor - size: 1
2 : DoubleTensor - size: 1x2
3 : DoubleTensor - size: 1
}
```

So now it works for mutable sizes.