I was porting the ResNet code from Torch (Lua Script) to PyTorch. I want to port the CAddTable
module which adds two tensors:
return nn.Sequential()
:add(nn.ConcatTable()
:add(s)
:add(shortcut(nInputPlane, n, stride)))
:add(nn.CAddTable(true))
:add(ReLU(true))
Apparently PyTorch used to have CAddTable
until version 0.4 which has now been deprecated (link).
What is the most suitable replacement for CAddTable
in PyTorch? Goes without saying but I have two branches of nn.Sequential()
modules which I want to merge together using CAddTable
into one nn.Sequential()
module.
I tried to create another module like this but the output is a Torch tensor, not an nn.Sequential()
module:
class my_CAddTable(nn.Module):
def __init__(self):
super(my_CAddTable, self).__init__()
def forward(self, x, y):
return torch.add(x, y)
Any leads are highly appreciated.