Here is the documentation for nn.Conv2d. Only the first argument depends on the input. You have to choose the remaining arguments based on what you want out of the convolution layer. See the section on “Shape” in that link for the details on how the output height and width are calculated from the arguments.