Use table layer in torch to add some branches

2019-08-27 22:13发布

问题:

I get stuck about nn package in torch7, especially its table layers. How can I use its ConcatTable and CAddTable or any other methods to create network below? I have seen this Stack Overflow question and I understand it's answer. but my problem is that if like the image below we have some branches and we wanted to use CAddTable(or any other methods) to just add two of them, how should we do that?(I need to create this model just using nn package and not other packages like nngraph).

Here is the Code that I used from the mentioned StackOverflow answer which is not what I want.

local net = nn.Sequential()
    :add(conv1)
    :add(nn.ConcatTable()
        :add(branch1)
        :add(branch2))
    :add(nn.CAddTable())