Specifying stride in Conv2D and ConvTranspose2d

I am trying to implement a Convolutional AutoEncoder following the python example here https://medium.com/dataseries/convolutional-autoencoder-in-pytorch-on-mnist-dataset-d65145c132ac. However, I am not sure how to specify the stride or padding parameters for the Convolution or Transpose convolution.

I looked at the MNIST example code here https://github.com/pytorch/examples/blob/main/cpp/mnist/mnist.cpp
but no stride is mentioned.

How can we specify the stride parameter?

I resolved this. You can pass these parameters using the torch::nn::Conv2dOptions and torch::nn::TransposeConv2dOptions types.