コード例 #1
0
ファイル: nn.cpp プロジェクト: AikaJune/nnfacedetect
void nn_free( neural_network_t *nn )
{
    for ( int i = 0; i < nn->nil; i++ )
    {
        free_neuron( &nn->il[i] );
    }
    for ( int i = 0; i < nn->nhl; i++ )
    {
        free_neuron( &nn->hl[i] );
    }
    for ( int i = 0; i < nn->nol; i++ )
    {
        free_neuron( &nn->ol[i] );
    }
    delete[] nn->hl;
    delete[] nn->ol;
    delete[] nn->il;
}
コード例 #2
0
ファイル: neuron.c プロジェクト: harryak/neural_net
/**
 *	Frees a neuron list and its contents.
 */
void free_neuron_list (neuron_head current_list_head) {
	if (NULL == current_list_head) return;

	neuron_head tmp = current_list_head;

	while (NULL != current_list_head) {
		free_neuron (current_list_head->current_neuron);
		current_list_head->prev->next = current_list_head->next;
		current_list_head->next->prev = current_list_head->prev;

		if (current_list_head->next == current_list_head) {
			tmp = NULL;
		} else {
			tmp = current_list_head->next;
		}

		free (current_list_head);

		current_list_head = tmp;
	}
}