feedforwardlayer.cpp
来自「amygdata的神经网络算法源代码」· C++ 代码 · 共 52 行
CPP
52 行
/*************************************************************************** feedforwardlayer.cpp - description ------------------- copyright : (C) 2005 by Matt Grover email : mgrover@amygdala.org ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include <stdexcept>#include <string> #include "feedforwardlayer.h"#include "synapseproperties.h"#include "synapse.h"#include "nconnector.h"#include "utilities.h"#include "spikingneuron.h"using namespace Amygdala;using namespace std;void FeedForwardLayer::InitNewNeuron(Neuron* nrn){}void FeedForwardLayer::ConnectUniform(Topology * outLayer, NConnector & nc, SynapseProperties & sProps, const float percentConnect){ for(const_iterator itPre = begin(); itPre != end(); itPre++){ for(const_iterator itPost = outLayer->begin(); itPost != outLayer->end(); itPost++){ if(1+(int) (10.0*rand()/(RAND_MAX+1.0)) <= percentConnect){ SpikingNeuron * sn = dynamic_cast <SpikingNeuron *> (*itPost); if(sn == NULL) throw runtime_error("Neuron id = " + Utilities::itostr((*itPost)->GetId()) + " is not a SpikingNeuron"); nc.Connect(*itPre, sn, sProps); } } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?