0

I get stuck about nn package in torch7, especially its table layers. How can I use its ConcatTable, CAddTable or any other methods to create network below?

image

Here I have two branch of my network, one contains 3 convolution layers and another only one layer. I wanted to sum the outputs of my last two convolution layers(sum the output of convolution 4th and convolution 5th), how should write my torch code using nn package.

4

1 回答 1

0

假设您的分支正确实施:

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

nn.CAddTable不要与 .混淆nn.Sum。第一个接收张量表并返回所有张量的总和,而第二个接收单个张量并沿指定维度计算其元素的总和。

于 2017-03-14T08:51:09.133 回答