Without double-checking what are the actual parameters to Conv2d, I assume the first two parameters are not input/output size, but number of channels.
The number of channels is the depth of a stack of image. Like, if you have r/g/b channels, you’d have three images, on top of each other, forming a stack of 3 images. Thats 3 channels. But you can, and normally do, have more than 3 channels. Typically, as you go through the cnn, each layer will make the stack deeper (more images per stack), but the width/height of the stack of images will gradually decrease.
ie, the input to a cnn is not 3 dimensional, but 4 dimensions:

batch size
number channels (depth of each stack of images)
width of image
height of image

Think of each batch of inputs as being a bunch of cubes. Each example is a cube of num_channels * image height * image width.