/// <summary> /// makes copy of layer of neurons /// </summary> /// <param name="copyNode"></param> /// <param name="topInputNode"></param> /// <param name="outputLength"></param> /// <param name="makeOnesArray"></param> internal LayerOfNeurons(ref LayerOfNeurons copyNode, ref AbstractNode topInputNode) { bool hasOnesArray = true; if (copyNode.BottomInputNode == null) { hasOnesArray = false; } this.initializer(ref topInputNode, copyNode.OutputArray.Length, copyNode.ActivationFunction, hasOnesArray); this.copyWeights(ref copyNode); }
/// <summary> /// copies over the weights from copyNode to this node /// </summary> /// <param name="copyNode"></param> private void copyWeights(ref LayerOfNeurons copyNode) { this.TopInputWeights = new double[copyNode.TopInputNode.OutputArray.Length, copyNode.OutputArray.Length]; copyArray(this.TopInputWeights, copyNode.TopInputWeights, copyNode.TopInputNode.OutputArray.Length, copyNode.OutputArray.Length); if (this.onesInputWeights != null) { this.onesInputWeights = new double[copyNode.onesInputWeights.Length]; copyArray(this.onesInputWeights, copyNode.onesInputWeights); } else if (this.BottomInputNode != null) { this.BottomInputWeights = new double[copyNode.BottomInputNode.OutputArray.Length, copyNode.OutputArray.Length]; copyArray(this.BottomInputWeights, copyNode.BottomInputWeights, copyNode.BottomInputNode.OutputArray.Length, copyNode.OutputArray.Length); } }
/// <summary> /// makes copy of layer of neurons /// </summary> /// <param name="copyNode"></param> /// <param name="topInputNode"></param> /// <param name="bottomInputNode"></param> /// <param name="activationFun"></param> internal LayerOfNeurons(ref LayerOfNeurons copyNode, ref AbstractNode topInputNode, ref AbstractNode bottomInputNode) { this.initializer(ref topInputNode, ref bottomInputNode, copyNode.OutputArray.Length, copyNode.ActivationFunction); this.copyWeights(ref copyNode); }