Assuming you would like to calculate the shape of some intermediate output activations you could either calculate the output shape using the shape formula for e.g. nn.Conv2d, which is given in the docs or alternatively you could add print statements into the forward method and print out the shapes.