⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layer.h

📁 基于VC开发的神经网络工具箱
💻 H
字号:
#ifndef _LAYER_H
#define _LAYER_H

#include "Neuron.h"
#include "Link.h"

namespace annie
{

/** Abstraction for a "layer" of neurons, i.e., a group of neurons not
  * connected to each other.
  * @see InputLayer
  */
class Layer
{
protected:
	/// The label of the layer
	int _label;

	/** The number of neurons in the layer.
	  * If you create a sub-class of this class, then the onus
	  * of ensuring that this value is consistent lies on you!
	  */
	int _size;

	/// The neurons in this layer.
	std::vector<Neuron *> _neurons;

public:
	/** The maximum number of neurons in a layer
	  * Needed for some automatic label assignments of neurons and layers
	  * in Networks
	  */
	static const int MAX_LAYER_SIZE;

	/** Constructs a layer with the given label */
	Layer(int label);

	virtual ~Layer();

	/// Returns the label of the layer
	virtual int getLabel();

	/// The size of the layer (number of neurons in it)
	virtual int getSize();

	/// Adds the given neuron to the layer
	virtual void addNeuron(Neuron *nrn);

	/** Gives the ith reference in the layer.
	  * @param i The index of the neuron in the layer (0<=i<getSize()).
	  * @throws Exception if the index given is invalid
	  */
	virtual Neuron& getNeuron(int i);
	
	/// The activation vector formed by the activations of individual neurons in the layer
	virtual VECTOR getActivation();
	
	/// The output vector formed by the outputs of individual neurons in the layer
	virtual VECTOR getOutput();

	/// Returns "Layer"
	virtual const char *getClassName();
};
}; //namespace annie
#endif // define _LAYER_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -