Slice layer solution

hi~ all is there any layer that work as slice layer in caffe?
i need to slice a tensor into several parts, is there any solution?
thanks

You could just slice tensors in your forward pass:

def forward(self, x):
    x = self.conv1(...
    a, b = x[:, :10, ...], x[:, 10:, :]

If you need a Layer doing this (e.g. since you are using nn.Sequential) you can wrap your slicing/indexing easily in another nn.Module and call it as a Layer.

1 Like