         std::cout << "(x_max_1, y_max_1) " << mat_max_max_1 << std::endl;
 
         std::cout << std::endl;
+
+        cudaMalloc((void**) &coeffs, num_out_neurons_last_layer*length_x*length_y*fp->layers[layerno]->input_size[2]*sizeof(float_type));
+        cudaMalloc((void**) &csts, num_out_neurons_last_layer*sizeof(float_type));
+
+        cudaMemset(coeffs, 0, num_out_neurons_last_layer*length_x*length_y*fp->layers[layerno]->input_size[2]*sizeof(float_type));
+        cudaMemset(csts, 0, num_out_neurons_last_layer*sizeof(float_type));
+
+        sparse_to_dense(fp->layers[layerno], coeffs, csts);
     }
     else
     {

            for(size_t out_z = 0; out_z < output_size_z; out_z++)
            {
                size_t i = (out_x + min_out_x)*output_size_y*output_size_z + (out_y + min_out_y)*output_size_z + out_z;
                size_t mat_out = n*output_size_x*output_size_y*output_size_z + i;

                elina_double_interval_mul(&tmp1, &tmp2, inf_coeff[mat_out], sup_coeff[mat_out], input_inf[i], input_sup[i]);
                res_sup = res_sup + tmp2;

    cudaFree(linf_cst);
    cudaFree(lsup_cst);

    /*
    cudaFree(linf_coeff_tmp);
    cudaFree(lsup_coeff_tmp);
    */
    cudaFree(linf_cst_tmp);
    cudaFree(lsup_cst_tmp);

