 
     layer_create_sparse_exprs(fp, filter_weights, filter_bias, input_size, filter_size, num_filters, strides, is_valid_padding, has_bias);
 
-    float_type* coeffs = fp->layers[0]->coeffs;
-    float_type* csts = fp->layers[0]->csts;
-
-    sparse_to_dense(fp->layers[0]);
-
-    layer_compute_bounds_from_exprs<<<fp->layers[0]->num_out_neurons, 1>>>(coeffs, csts, fp->layers[0]->lb_array, fp->layers[0]->ub_array, fp->input_inf, fp->input_sup, fp->layers[0]->num_out_neurons, fp->layers[0]->num_in_neurons);
+    float_type* coeffs_tmp;
+    float_type* csts_tmp;
+
+    cudaMalloc((void**) &coeffs_tmp, fp->layers[0]->num_out_neurons*fp->layers[0]->num_in_neurons*sizeof(float_type));
+    cudaMalloc((void**) &csts_tmp, fp->layers[0]->num_out_neurons*sizeof(float_type));
+
+    sparse_to_dense(fp->layers[0], coeffs_tmp, csts_tmp);
+
+    layer_compute_bounds_from_exprs<<<fp->layers[0]->num_out_neurons, 1>>>(coeffs_tmp, csts_tmp, fp->layers[0]->lb_array, fp->layers[0]->ub_array, fp->input_inf, fp->input_sup, fp->layers[0]->num_out_neurons, fp->layers[0]->num_in_neurons);
+
+    cudaFree(coeffs_tmp);
+    cudaFree(csts_tmp);
 }
 
 

    layer->lb_array = nullptr;
    layer->ub_array = nullptr;

    if(layer->type == CONV)
    {
        cudaFree(layer->filter_weights);
        cudaFree(layer->filter_bias);

        layer->filter_weights = nullptr;
        layer->filter_bias = nullptr;

        free(layer->input_size);
        free(layer->output_size);
        free(layer->filter_size);
        free(layer->strides);
        free(layer->pad);

        layer->input_size = nullptr;
        layer->output_size = nullptr;
        layer->filter_size = nullptr;
        layer->strides = nullptr;
        layer->pad = nullptr;
    }

    free(layer);
    layer = nullptr;

    copy_expr_array<<<num_out_neurons_last_layer, 1>>>(linf_coeff, lsup_coeff, linf_cst, lsup_cst, coeffs, csts, num_out_neurons_last_layer, num_in_neurons_last_layer);
    copy_expr_array<<<num_out_neurons_last_layer, 1>>>(uinf_coeff, usup_coeff, uinf_cst, usup_cst, coeffs, csts, num_out_neurons_last_layer, num_in_neurons_last_layer);

    if(fp->layers[layerno]->type == CONV)
    {
        cudaFree(coeffs);
        cudaFree(csts);
    }

    float_type* linf_coeff_tmp;
    float_type* lsup_coeff_tmp;
    float_type* linf_cst_tmp;
