# How do you train a neural network when inputs are not the same size?

Say I'm looking to train a neural network to decide the winner of a tic-tac-toe game (contrived example I realize). The problem is that the number of moves in a given game isn't always the same. Therefore, my inputs will be of varying lengths. Are there any strategies for training a NN that do not involve "normalizing" my inputs so they're all the same lengths?

I've found 3 other posts (1, 2, 3) with essentially this same question, but they all boil down to normalizing the data into equal lengths. Are there any other strategies? Or are there any other techniques instead of NNs that can handle varying input sizes?

• One possibility for dealing with arbitrary-length input is using Recurrent Neural Networks. If there is some order to the data (as there is in the moves in a game), the network will have 'context' when shown each new move. Another possibility people have explored is defining some lowest-level unit (a word, a move, etc) and passing them to a CNN in order. So a vector for move_1 is fed in with move_2. Then the resulting move_1_2 vector is fed with move_3, etc. Nov 17 '15 at 14:47
• Answer below for your second question. To your first, I have less to offer.—ANNs have been used in reinforcement learning, but I'm unfamiliar with the details. Nov 17 '15 at 14:48
• @jamesmf I'm a bit confused. How do I "feed move1 in with move2"? I combine the vectors in some way? When I add in move3, won't the vector be larger leaving me with my original problem? Or are you talking about some type of sliding window? Or simply feeding in the moves in order, regardless of how many there are? Nov 17 '15 at 15:48
• If you have vectors of size V the point is that you train a network that has input size of (2 x V) and output size (1 x V). At each time point you have 2 vectors of size V to feed to your network (one is the output from the step before, one is the next input). Nov 17 '15 at 16:10
• Another option, most closely comparable to using RNNs in that it doesn't require changing the input data, is SPP-net: research.microsoft.com/en-us/um/people/kahe/eccv14sppnet Nov 17 '15 at 17:54