2017-03-01 112 views
0

我试图解决这个问题很长一段时间,仍然不能拿出解决方案,也许有人可以帮我解决这个问题。我有以下AAABBB输入表到神经网络:将张量表的AAABBB表转换为火炬中张量的嵌套ABABAB表

{ 
    1 : 
    { 
     1 : DoubleTensor - size: 32x200 
     2 : DoubleTensor - size: 32x200 
     3 : DoubleTensor - size: 32x200 
    } 
    2 : 
    { 
     1 : DoubleTensor - size: 32x54 
     2 : DoubleTensor - size: 32x54 
     3 : DoubleTensor - size: 32x54 
    } 
} 

上表被预处理,然后需要被转化为嵌套ABABAB输入表:

{ 
    1 : 
    { 
     1 : DoubleTensor - size: 32x200 
     2 : DoubleTensor - size: 32x54 
    } 
    2 : 
    { 
     1 : DoubleTensor - size: 32x200 
     2 : DoubleTensor - size: 32x54 
    } 
    3 : 
    { 
     1 : DoubleTensor - size: 32x200 
     2 : DoubleTensor - size: 32x54   
    } 
} 

如何我可以将AAABBB表格更改为ABABAB嵌套网络使用Torch table layers

回答

0

看来,dpnn包包含一个Container完全是。 ZipTable将表格表格拉入表格中。

下面是如何AAABBB表转换成ABABAB嵌套表的工作示例。

require 'dpnn' 

aaa = torch.DoubleTensor(3,32,200) 
bbb = torch.DoubleTensor(3,32,54) 

model = nn.Sequential() 
par = nn.ParallelTable() 
par:add(nn.SplitTable(1)) 
par:add(nn.SplitTable(1)) 
model:add(par) 
model:add(nn.ZipTable()) 
model:forward({aaa,bbb}) 
相关问题