Hi,
You can compute output size using this formula: out = floor((in - kernel + 2*padding) / stride) + 1
So, in your case, floor((7 - 1 + 2*1) / 1) +1 = 9. There is two ways to have the identical output size, first of is to use proper kernel size which in your case it is 3 instead of 1. Second approach is to change the padding only for that particular channel which in your case, you need to use zero padding.
For the second approach this post may help you:

  
    
    
    How to pad one side in pytorch 
  
  
    By default pytorch only support padding on both side, but for example, I have a feature of 1x512x37x56(NCHW) and I want to pad on one side to 1x512x38x57, how can I do it?
  


Bests