Body: <p>I am new to deep learning so feel free to correct me where I am wrong.</p>
  <p>Imagine this scenario where we have a 7 * 7 input. We want to slide a 3 * 3 filter with a stride of 3 and padding of zero over this input. As you know, it is not possible to do this.</p>
  <p>Also, CNNs have a fixed input shape(Correct me if I am wrong) or at least the input should be of the multiples of the CNN's intended input shape(e.g., 112 * 112, 224 * 224, etc)(Although the situation that this may work is rare.)</p>
  <p>According to this <a href="https://pytorch.org/hub/pytorch_vision_resnet/" rel="nofollow noreferrer">PyTorch page</a>, ResNet (for example) accepts images of any size as long as they are bigger than 224.</p>
  <p>So my question is, how does it handle images of different sizes? Does it dynamically tweak parts of the structure (e.g., kernels, strides, paddings) based on the input? If yes, wouldn't that change the network architecture? Or it changes the input sizes to the intended size automatically?</p>
  <p>Also, <a href="https://ai.stackexchange.com/questions/2008/how-can-neural-networks-deal-with-varying-input-sizes?rq=1">this</a> does not answer my question.</p>
  
Tags: <neural-networks><deep-learning><convolutional-neural-networks><pytorch><convolutional-layers>
Title: How do CNNs handle inputs of different sizes and shapes?
UserDisplayName: Ali Khalili
ThreadText: # How do CNNs handle inputs of different sizes and shapes?
  
  (Asked by: username_0 on 2021-08-29)
  
  I am new to deep learning so feel free to correct me where I am wrong.
  
  Imagine this scenario where we have a 7 \* 7 input. We want to slide a 3 \* 3 filter with a stride of 3 and padding of zero over this input. As you know, it is not possible to do this.
  
  Also, CNNs have a fixed input shape(Correct me if I am wrong) or at least the input should be of the multiples of the CNN's intended input shape(e.g., 112 \* 112, 224 \* 224, etc)(Although the situation that this may work is rare.)
  
  According to this [PyTorch page](https://pytorch.org/hub/pytorch_vision_resnet/), ResNet (for example) accepts images of any size as long as they are bigger than 224.
  
  So my question is, how does it handle images of different sizes? Does it dynamically tweak parts of the structure (e.g., kernels, strides, paddings) based on the input? If yes, wouldn't that change the network architecture? Or it changes the input sizes to the intended size automatically?
  
  Also, [this](https://ai.stackexchange.com/questions/2008/how-can-neural-networks-deal-with-varying-input-sizes?rq=1) does not answer my question.
  
  **Tags:** neural-networks, deep-learning, convolutional-neural-networks, pytorch, convolutional-layers
  
  ---
  
  ## 0 answers
  
  