                 size_t* dim = (size_t*) malloc(num_coeff*sizeof(size_t));
                 size_t i = 0;
 
-                for(size_t inp_z = 0; inp_z < input_size[2]; inp_z++)
+                for(size_t x_shift = 0; x_shift < filter_size[0]; x_shift++)
                 {
-                    for(size_t x_shift = 0; x_shift < filter_size[0]; x_shift++)
+                    for(size_t y_shift = 0; y_shift < filter_size[1]; y_shift++)
                     {
-                        for(size_t y_shift = 0; y_shift < filter_size[1]; y_shift++)
+                        for(size_t inp_z = 0; inp_z < input_size[2]; inp_z++)
                         {
                             const long int x_val = out_x*strides[0] + x_shift - pad_top;
                             const long int y_val = out_y*strides[1] + y_shift - pad_left;

                    }
                }

                sort_sparse_expr(dim, coeff, actual_coeff);

                const double cst = has_bias ? filter_bias[out_z] : 0;

                double* dense_coeff = (double*) malloc(num_pixels*sizeof(double));

                size_t k = 0;
                for(size_t i = 0; i < num_pixels; i++)
                {
                    if((dim[k] == i) && (k < actual_coeff))
                    {
                        dense_coeff[i] = coeff[k];
                        k++;
                    }
                    else
                    {
                        dense_coeff[i] = 0.;
                    }
                }

                expr_t* res = (expr_t*) malloc(sizeof(expr_t));

*/


layer_t* create_layer(const size_t num_out_neurons, const size_t num_in_neurons, const layertype_t type, const activation_type_t activation)
{
    layer_t* layer = (layer_t*) malloc(sizeof(layer_t));
