src/skipgram_mixture_neural_network.cpp
//Collect all the input words and output nodes in the data block
Collect all the input words and output nodes in the data block
Collect all the input words and output nodes in the data block
void SkipGramMixtureNeuralNetwork<T>::PrepareParmeter(DataBlock* data_block)
{
	for (int i = 0; i < m_input_layer_nodes.size(); ++i)
	{
		m_input_embedding_weights_ptr[m_input_layer_nodes[i]] = nullptr;
		m_seleted_input_embedding_weights[m_input_layer_nodes[i]] = false;
	}
	for (int i = 0; i < m_output_layer_nodes.size(); ++i)
	{
		m_output_embedding_weights_ptr[m_output_layer_nodes[i]] = nullptr;
		m_selected_output_embedding_weights[m_output_layer_nodes[i]] = false;
	}
	m_input_layer_nodes.clear();
	m_output_layer_nodes.clear();
	int sentence_length;
	int64_t word_count_deta;
	int* sentence;
	uint64_t next_random;
	for (int i = 0; i < data_block->Size(); ++i)
	{
		data_block->Get(i, sentence, sentence_length, word_count_deta, next_random);
		ParseSentence(sentence, sentence_length, nullptr, nullptr, nullptr, &SkipGramMixtureNeuralNetwork<T>::DealPrepareParameter);
	}
}
void SkipGramMixtureNeuralNetwork < T > :: PrepareParmeter ( DataBlock * data_block ) { for ( int i = 0 ; i < m_input_layer_nodes . size ( ) ; ++ i ) { m_input_embedding_weights_ptr [ m_input_layer_nodes [ i ] ] = nullptr ; m_seleted_input_embedding_weights [ m_input_layer_nodes [ i ] ] = false ; } for ( int i = 0 ; i < m_output_layer_nodes . size ( ) ; ++ i ) { m_output_embedding_weights_ptr [ m_output_layer_nodes [ i ] ] = nullptr ; m_selected_output_embedding_weights [ m_output_layer_nodes [ i ] ] = false ; } m_input_layer_nodes . clear ( ) ; m_output_layer_nodes . clear ( ) ; int sentence_length ; int64_t word_count_deta ; int * sentence ; uint64_t next_random ; for ( int i = 0 ; i < data_block -> Size ( ) ; ++ i ) { data_block -> Get ( i , sentence , sentence_length , word_count_deta , next_random ) ; ParseSentence ( sentence , sentence_length , nullptr , nullptr , nullptr , & SkipGramMixtureNeuralNetwork < T > :: DealPrepareParameter ) ; } }
Collect all the input words and output nodes in the data block
Collect all the input words and output nodes in the data block