This is a tricky question because your input size will can depend on several components of your model. The short answer is you can't.
Concerning the number of channels in your input tensor, you can infer this solely based on the first convolutional layer. Assuming your model is a two dimensional convolutional network, then you can get the input channel number based on :
for child in model.modules():
if type(child).__name__ == 'Conv2d':
print(child.weight.size(1))
break
Now for the input size, as I said you may not be able to infer this information at all. Indeed some convolutional networks, such as classification networks, may require specific dimensions such that the bottleneck can be flattened and fed into a fully-connected network. This is not always true though, networks that use some sort of pulling operation (average, or maximum pulling) will alleviate the need to provide fixed input shapes. Other networks such as dense prediction networks may not need to get a specific shape as the input, given the symmetry between input and output...
This all depends on the network's design and as such, I'm afraid there is no definitive answer to your question.