<p>There are solutions for Convolutional Neural Networks apart from just resizing the input to a fixed size.</p>

<p><a href="https://arxiv.org/abs/1406.4729" rel="nofollow">Spatial Pyramid Pooling</a> allows you to train and test CNNs with variable sized images, and it does this by introducing a dynamic pooling layer, where the input can be of any size, and the output is of a fixed size, which then can be fed to the fully connected layers.</p>

<p>The pooling is very simple, one defines with a number of regions in each dimension (say 7x7), and then the layer splits each feature map in non-overlapping 7x7 regions and does max-pooling on each region, outputing a 49 element vector. This can also be applied at multiple scales.</p>
How to create a neural network that has a dynamic input?
<p>This question is a tough one: <strong><em>How can I feed a neural network, a dynamic input?</em></strong>  </p>

<p>Answering this question will certainly help the advance of modern AI using deep learning  for applications other than computer vision and speech recognition.
I will explain this problem further for the laymen on neural networks.</p>

<p><strong>Let's take this simple example for instance:</strong></p>

<p>Say you need to know the probability of winning, losing or drawing in a game of "tic-tac-toe".</p>

<p>So my <strong>input</strong> could be a [3,3] matrix representing the state (1-You, 2-Enemy, 0-Empty):</p>

<pre><code>[2. 1. 0.]  
[0. 1. 0.] 
[2. 2. 1.]
</code></pre>

<p>Let's assume we already have a <strong>previously trained hidden layer</strong>, a [3,1] matrix of weights:</p>

<pre><code>[1.5]  
[0.5]  
[2.5]
</code></pre>

<p>So if we use a simple activation function that consists basically of a matrix multiply between the two <strong>y(x)=W*x</strong> we get this [3,1] matrix in the <strong>output</strong>:</p>

<pre><code>[2. 1. 0.]     [1.5]     [3.5]
[0. 1. 0.]  *  [0.5]  =  [0.5]
[2. 2. 1.]     [2.5]     [6.5]
</code></pre>

<p>Even without a softmax function you can tell that the highest probability is of having a draw.</p>

<p><em><strong>But what if I want this same neural network to work for a 5x5 game of tic-tac-toe?</strong></em></p>

<p>It has the same logic as the 3x3, its just bigger. The neural network <strong>should</strong> be able to handle it  </p>

<p>We would have something like:</p>

<pre><code>[2. 1. 0. 2. 0.]
[0. 2. 0. 1. 1.]     [1.5]     [?]
[2. 1. 0. 0. 1.]  *  [0.5]  =  [?]                           IMPOSSIBLE
[0. 0. 2. 2. 1.]     [2.5]     [?]
[2. 1. 0. 2. 0.]
</code></pre>

<p>But this multiplication would be <strong>impossible to compute</strong>. We would have to <strong>add more layers and/or change our previously trained one</strong> and <strong>RETRAIN</strong> it, because the untrained weights (initialized with 0 in this case) would cause the neural network to fail, like so:</p>

<pre><code>     input            1st Layer        output1
[2. 1. 0. 2. 0.]     [0.  0. 0.]     [6.5 0. 0.]
[0. 2. 0. 1. 1.]     [1.5 0. 0.]     [5.5 0. 0.]
[2. 1. 0. 0. 1.]  *  [0.5 0. 0.]  =  [1.5 0. 0.]
[0. 0. 2. 2. 1.]     [2.5 0. 0.]     [6.  0. 0.]
[2. 1. 0. 2. 0.]     [0.  0. 0.]     [6.5 0. 0.]

   2nd Layer           output1      final output
                     [6.5 0. 0.]
                     [5.5 0. 0.]
[0. 0. 0. 0. 0.]  *  [1.5 0. 0.]  =  [0. 0. 0.]                POSSIBLE
                     [6.  0. 0.]
                     [6.5 0. 0.]
</code></pre>

<p>Because we expanded the first layer and added a new layer of zero weights, our <strong>result is obviously inconclusive</strong>. If we apply a softmax function we will realize that the neural network is returning 33.3% chance for every possible outcome. <strong>We would need to train it again</strong>.</p>

<p>Obviously we want to create generic neural networks that can adapt to different input sizes, however I haven't thought of a solution for this problem yet! So I thought maybe stackoverflow can help. Thousands of heads think better than one. <strong>Any ideas?</strong></p>