ParallelTable is a container module that, in its forward
method, applies the ith
member module to the ith
input, and outputs a table of the set of outputs.
Example:
mlp= nn.ParallelTable() mlp:add(nn.Linear(10,2)) mlp:add(nn.Linear(5,3)) require "lab" x=lab.randn(10) y=lab.rand(5) pred=mlp:forward{x,y} for i,k in pairs(pred) do print(i,k); endwhich gives the output:
1 0.0331 0.7003 [torch.Tensor of dimension 2] 2 0.0677 -0.1657 -0.7383 [torch.Tensor of dimension 3]