Solved by vainaijr in post #2 
              
              
                maybe, 
class CustomPool(nn.Module):
  def __init__(self, size):
    super().__init__()
    self.size = size
  def forward(self, x):
    y = torch.repeat_interleave(x, self.size)
    y.index_fill_(0, torch.arange(1, y.size()[0], self.size), 0)
    print(y)
    return y # or reshape it

model = nn.Se…