public void createFromTopology() { neuralLayers = new NeuralLayer <T> [topology.LayerCount]; if (!topology.Verified) { topology.verify(); } NeuralNode <T> currentNode; TopologyEntry currentEntry; int currentLayer; for (int i = 0; i < topology.Count; i++) { currentEntry = topology.adj_M[i]; currentLayer = currentEntry.layer; if (neuralLayers[currentLayer] == null) { if (currentLayer == 0) { neuralLayers[currentLayer] = new InputLayer <T>(); } else { neuralLayers[currentLayer] = new NeuralLayer <T>(); } } if (topology.adj_M[i].layer == 0) { currentNode = new ConstInputNeuralNode <T>(); } else { if (topology.adj_M[i].memoryDepth > 0) { currentNode = new MemoryNode <T>(topology.adj_M[i].memoryDepth); } else { currentNode = new NeuralNode <T>(); } foreach (float w in currentEntry.adj_V) { if (!float.IsNaN(w)) { currentNode.InputWeigths.Add(w); } } } neuralLayers[currentLayer].addNode(currentNode); } for (int i = 1; i < topology.LayerCount; i++) { neuralLayers[i].inputLayer = neuralLayers[i - 1]; } }
public object Clone() { NeuralLayer <T> ret = new NeuralLayer <T>(); for (int i = 0; i < NodeCount; i++) { ret.addNode(nodes[i].Clone() as NeuralNode <T>); } if (outputs != null) { ret.outputs = outputs.Clone() as T[]; } return(ret); }