hi i want to fuse features from certain layers in network say resnet 50 and provide that as input to subsequent layers how do i do it.

- Extraction of features from desired layers
- concat it and give that as input.

Please provide forward method for such kind of fusion…

Kushaj
(Kushajveer Singh)
#2
```
class Model(nn.Module):
def __init__(self):
super().__init__()
self.linear1 = nn.Linear(5, 5)
self.linear2 = nn.Linear(5, 5)
self.linear3 = nn.Linear(5, 5)
def forward(self, x):
x1 = self.linear1(x)
print(x.size())
x2 = self.linear2(x1)
print(x.size())
x3 = self.linear3(x2)
# Fuse output from linear1 with output of linear3
x = torch.cat((x1, x3), 0)
print(x.size())
return x
model = Model()
x = torch.rand(2, 5)
output = model(x)
```

```
torch.Size([2, 5])
torch.Size([2, 5])
torch.Size([4, 5])
```

Thanks…

If suppose Last layer was to get input of 10 instead of 5…Linear(10,5)

how would the concat statement look like,