示例#1
0
/**
 * These are the base set of fields for any object managing synapses.
 * Note that these are duplicated in SynChanBase: if you change anything
 * here it must also be reflected there.
 */
const Cinfo* SynHandlerBase::initCinfo()
{
	static ValueFinfo< SynHandlerBase, unsigned int > numSynapses(
		"numSynapses",
		"Number of synapses on SynHandler. Duplicate field for num_synapse",
		&SynHandlerBase::setNumSynapses,
		&SynHandlerBase::getNumSynapses
	);
	//////////////////////////////////////////////////////////////////////
	static DestFinfo process( "process",
		"Handles 'process' call. Checks if any spike events are due for"
		"handling at this timestep, and does learning rule stuff if needed",
		new ProcOpFunc< SynHandlerBase >(& SynHandlerBase::process ) );
	static DestFinfo reinit( "reinit",
		"Handles 'reinit' call. Initializes all the synapses.",
		new ProcOpFunc< SynHandlerBase >(& SynHandlerBase::reinit ) );

	static Finfo* processShared[] =
	{
		&process, &reinit
	};
	static SharedFinfo proc( "proc",
		"Shared Finfo to receive Process messages from the clock.",
		processShared, sizeof( processShared ) / sizeof( Finfo* )
	);

	//////////////////////////////////////////////////////////////////////
	static Finfo* synHandlerFinfos[] = {
		&numSynapses,		// Value
		activationOut(),	// SrcFinfo
		&proc, 				// SharedFinfo
	};

	static string doc[] =
	{
		"Name", "SynHandlerBase",
		"Author", "Upi Bhalla",
		"Description",
		"Base class for handling synapse arrays converging onto a given "
		"channel or integrate-and-fire neuron. This class provides the "
		"interface for channels/intFires to connect to a range of synapse "
		"types, including simple synapses, synapses with different "
		"plasticity rules, and variants yet to be implemented. "
	};
	static ZeroSizeDinfo< int > dinfo;
	static Cinfo synHandlerCinfo (
		"SynHandlerBase",
		Neutral::initCinfo(),
		synHandlerFinfos,
		sizeof( synHandlerFinfos ) / sizeof ( Finfo* ),
		&dinfo,
		doc,
		sizeof( doc ) / sizeof( string )
	);

	return &synHandlerCinfo;
}
示例#2
0
// Feed ANN with input and receive output
void ANN::feedThrough(double* input, double* output) {
	copy(input, in_data_, inp_);
	in_data_[inp_] = 1;
	
	multiply(fl_, in_data_, mid_data_, hid_, inp_+1, 1);
	activation(mid_data_, hid_);
	mid_data_[hid_] = 1;

	multiply(sl_, mid_data_, output, out_, hid_+1, 1);
	activationOut(output, out_);
}