So you have an input with this format Batch x Channels x Width x Height and you want to apply a 5x5 kernel to generate an output of [BxCxWxHx1x10] or [Bx10*CxWxH]
can you not use Conv2d? here is my code for it
a = torch.rand(1,100,20,30)
cnv = torch.nn.Conv2d(in_channels=100, out_channels=100*10, kernel_size=5, stride=1, padding=2)
b = cnv(a).view(1,100,20,30,1,10)