 
     std::cout << "num_out_neurons_last " << num_out_neurons_last_layer << std::endl;
 
-    float_type* coeffs = fp->layers[layerno]->coeffs;
-    float_type* csts = fp->layers[layerno]->csts;
+    float_type* coeffs;
+    float_type* csts;
+
+    if(fp->layers[layerno]->type == CONV)
+    {
+        cudaMalloc((void**) &coeffs, num_out_neurons_last_layer*num_in_neurons_last_layer*sizeof(float_type));
+        cudaMalloc((void**) &csts, num_out_neurons_last_layer*sizeof(float_type));
+
+        sparse_to_dense(fp->layers[layerno], coeffs, csts);
+    }
+    else
+    {
+        coeffs = fp->layers[layerno]->coeffs;
+        csts = fp->layers[layerno]->csts;
+    }
 
     float_type* lb_array = fp->layers[layerno]->lb_array;
     float_type* ub_array = fp->layers[layerno]->ub_array;

    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);

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

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

    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;
