 
     return abstract0_of_fppoly(man, res);
 }
+*/
 
 
 void fppoly_add_new_layer(fppoly_t* const fp, const size_t size, const layertype_t type, const activation_type_t activation)

{
    fppoly_t* const fp = fppoly_of_abstract0(element);
    fp->layers = (layer_t**) malloc(20*sizeof(layer_t*));
    fp->numlayers = 0;

    layer_create_sparse_exprs(fp, filter_weights, filter_bias, input_size, filter_size, num_filters, strides, is_valid_padding, has_bias);


}


void device_layer_create_dense_expr(neuron_t** neurons, const double* weights, const double* bias, const size_t num_out_neurons, const size_t num_in_neurons)
{
    for(size_t i = 0; i < num_out_neurons; i++)
    {
        neuron_t* neuron = neurons[i];
        const double* weight_i = weights + i*num_in_neurons;
        const double bias_i = bias[i];
        neuron->expr = create_dense_expr(weight_i, bias_i, num_in_neurons);
    }
}


void layer_create_dense_exprs(neuron_t** neurons, const double** weights, const double* bias, const size_t num_out_neurons, const size_t num_in_neurons)
{
    double* tmp_weights = (double*) malloc(num_out_neurons*num_in_neurons*sizeof(double));
    double* tmp_bias = (double*) malloc(num_out_neurons*sizeof(double));

    for(size_t i = 0; i < num_out_neurons; i++)
    {
        cudaMemcpy(tmp_weights + i*num_in_neurons, weights[i], num_in_neurons*sizeof(double), cudaMemcpyHostToHost);
    }

    cudaMemcpy(tmp_bias, bias, num_out_neurons*sizeof(double), cudaMemcpyHostToHost);

    device_layer_create_dense_expr(neurons, tmp_weights, tmp_bias, num_out_neurons, num_in_neurons);

    free(tmp_weights);
    free(tmp_bias);
}


void layer_copy_exprs(neuron_t** neurons, expr_t** lexpr_array, expr_t** uexpr_array, const size_t size)
{
    for(size_t i = 0; i < size; i++)
    {
        lexpr_array[i] = copy_expr(neurons[i]->expr);
        uexpr_array[i] = copy_expr(neurons[i]->expr);
    }
}


void layer_assign_bounds(neuron_t** neurons, double* lb_array, double* ub_array, const size_t size)
{
    for(size_t i = 0; i < size; i++)
    {
        neurons[i]->lb = lb_array[i];
        neurons[i]->ub = ub_array[i];
    }
}


void free_expr_arrays(expr_t** lexpr_array, expr_t** uexpr_array, const size_t size)
{
    for(size_t i = 0; i < size; i++)
    {
        free_expr(lexpr_array[i]);
        free_expr(uexpr_array[i]);
    }
}

