Ejemplo n.º 1
0
 /// <summary>
 /// Add a layer to the neural network. If there are no layers added this
 /// layer will become the input layer. This function automatically updates
 /// both the input and output layer references.
 /// </summary>
 /// <param name="layer">The layer to be added to the network.</param>
 /// <param name="type">What sort of synapse should connect this layer to the last.</param>
 public void AddLayer(ILayer layer, SynapseType type)
 {
     // is this the first layer? If so, mark as the input layer.
     if (this.layerTags.Count == 0)
     {
         this.TagLayer(BasicNetwork.TAG_INPUT, layer);
         this.TagLayer(BasicNetwork.TAG_OUTPUT, layer);
     }
     else
     {
         // add the layer to any previous layers
         ILayer outputLayer = this.GetLayer(BasicNetwork.TAG_OUTPUT);
         outputLayer.AddNext(layer, type);
         this.TagLayer(BasicNetwork.TAG_OUTPUT, layer);
     }
 }