Depends what you want to do. If you don’t want the paremeter sharing, then you second sample
def make_resblock(in_channels,out_channels,kernel_size,stride,padding):
    return nn.Sequential(
           nn.Conv2d(in_channels, out_channels, kernel_size, stride,padding),
           nn.BatchNorm2d(out_channels),
          nn.ReLU(),
           nn.Conv2d(out_channels, out_channels, kernel_size, stride,padding),
           nn.BatchNorm2d(out_channels),
          nn.ReLU()
      )

Is what you want.
If you do want the parameter sharing, then your code is good but it does not seem to work in practice.