You can use pad to match the dimension you want.
nn.Conv2d(...padding=1) # H*W
nn.Conv2d(...padding=2) # (H+2)*(W+2)
If you want (H+1)*(W+1) in this case, you can produce H*W and pad by (left=0,right=1,top=0,bottom=1) to get (H+1)*(W+1).