Need a help for channel wise encoding

I have an input tesor (2,5,10), batch size 2, channels 5, temporal dimension 10.so i need to encode this signal into 512 dimension channel-wise. that means after the encoding, each channel should have 512 dimensions and the output will look like (2, 5*512,1) as the encoded signal. how can i do it using a 1Dconv in Pytorch? the encoder weights should be the same for all 5 channels.