# How to handle varying length of inputs that represent dependencies and recursivity in deep neural networks in case of regression?

I wanna solve a problem of regression to predict a factor. I decide to go with Deep Neural Networks as solution for my problem.

The features in this problem represent loop characteristic such us loop nest level, loop sizes. The loops hold also instruction (operations) that in itself represent many characteristics like number of variables, loads, stores, etc.

Those instructions maybe positions in the innermost loop or in the middle or under the outermost loop.

We extract here characteristics of Computations in Tiramisu language.

For example, if we have two iterator variables:

var i("i", 0, 20), j("j", 0, 30);


and we have the following computation declaration:

computation S("S", {i,j}, 4);


This is equivalent to writing the following C code:

 for (i=0; i<20; i++)
for (j=0; j<30; j++)
S(i,j) = 4;


The aspect of receptivity here we can have something like this:

 computation S("S", {i,j}, 4+M);


where "M" is computation also.

We considered those features to represent Computations in Tiramisu language.

/** Computations=loops **/
"nest_level" : 3,   // Number of nest levels
"perfect_nested" : 1 ,  // 1 if the loop is perfectly nested , 0 instead
"loops_sizes" : [200,100,300] // Sizes of for loops
"lower_bound" : [5,0,0], // Bounds of the iterator (in this e.g [2, 510])
"upper_bound" : [205,100,300],
"nb_intern_if" : 1000, //number of if statements in the nest
"nb_exec_if" : 300, // Estimation of number if
"prec_if" : 1,  // 1=true if the nest is preceded by if statement
"nb_dependencies_intern" : 5, // number of dependencies between loops levels in the nest
// "dependencies_extern" : , // number of extern nest dependencies
"nb_computations" : 3,  // number of operations (computations) in the nest
//std::map<std::string, computation_features *> computations_features; // list of operations Features in the nest


And this to represent operations:

/** Instructions **/
"n" : 1, <-- Number of computations
"compt_array" : [
{
// Should we add to which level should belong the instructions ?

"comp_id" : 1,  // Unique id for the instructions
"nb_var" : 5,   // Number of the variables in the instructions
"nb_const" : 2, // Number of constantes in the instructions
"nb_operands" : 3, // Number of operands of the operatiion ( including direct values)
"histograme_loads" :  [2,1,5,8], // number of load ops. i.e. acces to inputs per type
"histograme_stores" :  [2,1,5,8], // number of load ops. i.e. acces to inputs per type
"nb_library_call" : 5;  // number of the computation library_calls
"wait_library_argument" : 2, // number of ar
"operations_histogram" : [ // number of arithmetic operations per type
[0, 2, 0, 0],  // p_int32
[0, 0, 0, 0],  // float, for example
[0, 0, 0, 0],  // ...
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0], // ...
[0, 0, 0, 0]  // boolean
]
}
]


We may also represent iterator as a characteristic of computation.

The problem in those features we have:

1. Loops (Computations) can hold many operations ==> the size of operation vector is variable.

2. Instructions (Operations) can be in the level 2, 3 under the innermost I mean we can have this situation:

for (i=0; i < 20; i++)
S(i, j) = 4;
for (j=0; j < 30; j++)
...


or this one:

for (i=0; i<20; i++)
for (j=0; j<30; j++)
S(i,j) = 4;


Or many other situations with many instructions ==> their is dependencies between the position of the instruction and the level (iterator) in which it is, in the other way operation hold the id of the iterator :§.

1. The operation on itself can be composed with another Computation(Loop nest) which on itself hold instruction and so forth ==> Resistivity.

After some research i have found that that DNN has fixed input size. RNN, recursive NN can handle with varying length of inputs. But what about others

how should I present that as input?