inline bool Map::isW3x() const { if (m_map.get() == 0) return false; return typeid(*m_map.get()) == typeid(map::W3x); }
void fill() { order.clear(); MapPtr nodes = ::root_map->get( "Nodes" ); Map::iterator i = nodes->begin(); Map::iterator iend = nodes->end(); while( i != iend ) { NodeLayerPtr node = nodes->get( i ); BooleanPtr enabled( node->get( "enabled" ) ); if( node->asyncRecallOrder() && enabled->get() ) { size_t neurons = node->numNeurons(); for( size_t i = 0; i < neurons; ++i ) { order.push_back( NodeNeuron( node, i ) ); } } i++; } }
void nnet::learn() { if( ::exec_map->empty() ) { // train synchronous layers first { MapPtr nodes = ::root_map->get( "Nodes" ); Map::iterator i = nodes->begin(); Map::iterator iend = nodes->end(); while( i != iend ) { NodeLayerPtr node = nodes->get( i ); BooleanPtr enabled( node->get( "enabled" ) ); if( !node->asyncRecallOrder() && enabled->get() ) { learn( node ); } i++; } } // then train async layers { RecallOrder::iterator i = recall_order.order.begin(); RecallOrder::iterator iend = recall_order.order.end(); while( i != iend ) { i->node->learn( i->neuron ); i++; } } } else { try { ExecEnginePtr exec( ::exec_map->first() ); exec->learn(); } catch( std::exception& e ) { LOG_EXCEPTION_E( e ); error::std_exception( "nnet::Learn() running ExecEngine", e.what() ); return; } catch( ... ) { LOG_EXCEPTION; error::alert( "Critical exception in ExecEngine!" ); } } nnet::global::learn_signal(); }