 
                 const size_t mat_y = x_val*input_size_y*input_size_z + y_val*input_size_z + inp_z;
 
-                if(mat_y >= num_pixels)
-                {
-                    continue;
-                }
-
                 //if(out_x == 0 && out_y == 0 && out_z == 0)
                 //printf("%lu ", mat_y);
 

__global__
void layer_compute_bounds_from_exprs_conv(const float_type* __restrict__ coeffs, const float_type* __restrict__ csts, float_type* __restrict__ lb_array, float_type* __restrict__ ub_array, const float_type* __restrict__ input_inf, const float_type* __restrict__ input_sup, const size_t output_size_x, const size_t output_size_y, const size_t output_size_z, const size_t input_size_x, const size_t input_size_y, const size_t input_size_z, const size_t filter_size_x, const size_t filter_size_y, const size_t stride_x, const size_t stride_y, const long int pad_x, const long int pad_y)
{
    for(size_t out_x = 0; out_x < output_size_x; out_x++)
    {
        for(size_t out_y = 0; out_y < output_size_y; out_y++)
        {
            for(size_t out_z = 0; out_z < output_size_z; out_z++)
            {
                const size_t mat_out = out_x*output_size_y*output_size_z + out_y*output_size_z + out_z;

                float_type res_inf = -csts[out_z];
                float_type res_sup = csts[out_z];

                float_type tmp1, tmp2;

                for(size_t x_shift = 0; x_shift < filter_size_x; x_shift++)
                {
                    for(size_t y_shift = 0; y_shift < filter_size_y; y_shift++)
                    {
                        for(size_t inp_z = 0; inp_z < input_size_z; inp_z++)
                        {
                            const long int x_val = out_x*stride_x + x_shift - pad_x;
                            const long int y_val = out_y*stride_y + y_shift - pad_y;

                            if((y_val < 0) || (y_val >= (long int)input_size_y))
                            {
                                continue;
                            }

                            if((x_val < 0) || (x_val >= (long int)input_size_x))
                            {
                                continue;
                            }

                            const size_t mat_in = x_val*input_size_y*input_size_z + y_val*input_size_z + inp_z;

                            const size_t filter_index = out_z*filter_size_x*filter_size_y*input_size_z + x_shift*filter_size_y*input_size_z + y_shift*input_size_z + inp_z;
                            elina_double_interval_mul(&tmp1, &tmp2, -coeffs[filter_index], coeffs[filter_index], input_inf[mat_in], input_sup[mat_in]);
                            res_inf = res_inf + tmp1;
                            res_sup = res_sup + tmp2;
                        }
                    }
                }

                lb_array[mat_out] = res_inf;
                ub_array[mat_out] = res_sup;
            }
        }
    }
}



                coeffs_from_previous_layer_conv_sparse<<<dim3(fp->layers[layerno]->output_size[0], fp->layers[layerno]->output_size[1], fp->layers[layerno]->output_size[2]), dim3(fp->layers[k]->input_size[2], fp->layers[k]->filter_size[1], fp->layers[k]->filter_size[0])>>>(linf_coeff, lsup_coeff, linf_coeff_tmp, lsup_coeff_tmp, fp->layers[k]->filter_weights, fp->layers[k]->output_size[0], fp->layers[k]->output_size[1], fp->layers[k]->output_size[2], fp->layers[k]->input_size[0], fp->layers[k]->input_size[1], fp->layers[k]->input_size[2], offset_x, offset_y, length_x, length_y, shift_x, shift_y, fp->layers[k]->filter_size[0], fp->layers[k]->filter_size[1], fp->layers[k]->strides[0], fp->layers[k]->strides[1], fp->layers[k]->pad[0], fp->layers[k]->pad[1]);
                coeffs_from_previous_layer_conv_sparse<<<dim3(fp->layers[layerno]->output_size[0], fp->layers[layerno]->output_size[1], fp->layers[layerno]->output_size[2]), dim3(fp->layers[k]->input_size[2], fp->layers[k]->filter_size[1], fp->layers[k]->filter_size[0])>>>(uinf_coeff, usup_coeff, uinf_coeff_tmp, usup_coeff_tmp, fp->layers[k]->filter_weights, fp->layers[k]->output_size[0], fp->layers[k]->output_size[1], fp->layers[k]->output_size[2], fp->layers[k]->input_size[0], fp->layers[k]->input_size[1], fp->layers[k]->input_size[2], offset_x, offset_y, length_x, length_y, shift_x, shift_y, fp->layers[k]->filter_size[0], fp->layers[k]->filter_size[1], fp->layers[k]->strides[0], fp->layers[k]->strides[1], fp->layers[k]->pad[0], fp->layers[k]->pad[1]);

                csts_from_previous_layer_conv_sparse<<<dim3(fp->layers[layerno]->output_size[0], fp->layers[layerno]->output_size[1], fp->layers[layerno]->output_size[2]), 1>>>(linf_coeff, lsup_coeff, linf_cst, lsup_cst, linf_cst_tmp, lsup_cst_tmp, fp->layers[k]->filter_bias, num_out_neurons_last_layer, fp->layers[k]->output_size[0], fp->layers[k]->output_size[1], fp->layers[k]->output_size[2], offset_x, offset_y, length_x, length_y, shift_x, shift_y);
                csts_from_previous_layer_conv_sparse<<<dim3(fp->layers[layerno]->output_size[0], fp->layers[layerno]->output_size[1], fp->layers[layerno]->output_size[2]), 1>>>(uinf_coeff, usup_coeff, uinf_cst, usup_cst, uinf_cst_tmp, usup_cst_tmp, fp->layers[k]->filter_bias, num_out_neurons_last_layer, fp->layers[k]->output_size[0], fp->layers[k]->output_size[1], fp->layers[k]->output_size[2], offset_x, offset_y, length_x, length_y, shift_x, shift_y);

                std::cout << "SECOND:" << std::endl;

                const long int x_min_0_old = offset_x;
