private Network PreTrainComplete(Network PPreTrainNet) { PPreTrainNet.Save(CreateSpecificFilePath("pretrain.net")); int numlayerspt = PPreTrainNet.NumLayers; int numlayersnew = numlayerspt * 2; ILayer inputlayer = PPreTrainNet.InputLayer.Clone(); ILayer[] layers = new ILayer[numlayersnew]; double[] learnrate = new double[numlayersnew]; double[][][] weights = new double[numlayersnew][][]; for (int i = 0; i < numlayerspt; i++) { ILayer copylayer = PPreTrainNet.Layers[i]; layers[i] = copylayer.Clone(); learnrate[i] = PPreTrainNet.Learnrates[i]; weights[i] = (double[][])PPreTrainNet.Weights[i].Clone(); } for (int i = 0; i < numlayerspt - 1; i++) { ILayer copylayer = PPreTrainNet.Layers[i]; int copydestination = numlayerspt * 2 - i - 2; layers[copydestination] = copylayer.Clone(); learnrate[copydestination] = PPreTrainNet.Learnrates[i]; } for (int i = 0; i < numlayerspt; i++) { int copydestination = numlayerspt * 2 - i - 1; weights[copydestination] = Utility.TransposeArray(PPreTrainNet.Weights[i]); } layers[numlayersnew - 1] = PPreTrainNet.InputLayer.Clone(); learnrate[numlayersnew - 1] = PPreTrainNet.Learnrates[0]; weights[numlayersnew - 1] = Utility.TransposeArray(PPreTrainNet.Weights[0]); return(new Network(inputlayer, layers, weights, null, learnrate)); }
/// <summary> /// Copy a layerage ( form Layerbase to Clipboard). /// </summary> /// <param name="layerage"> The layerage. </param> public static void CopyLayerage(Layerage layerage) { // ILayer layer = layerage.Self; ILayer clone2 = layer.Clone(); Clipboard.Instances.Add(clone2); // LayerManager.CopyLayeragesCore(layerage.Children); }
/// <summary> /// Copy a layerage ( form Layerbase to Clipboard). /// </summary> /// <param name="customDevice"> The custom-device. </param> /// <param name="layerage"> The layerage. </param> public static void CopyLayerage(CanvasDevice customDevice, Layerage layerage) { // ILayer layer = layerage.Self; ILayer clone2 = layer.Clone(customDevice); Clipboard.Instances.Add(clone2); // LayerageCollection._copyLayerage(customDevice, layerage.Children); }
private static void CopyLayeragesCore(IList <Layerage> children) { foreach (Layerage layerage in children) { LayerManager.CopyLayeragesCore(layerage.Children); // ILayer layer = layerage.Self; ILayer clone = layer.Clone(); Clipboard.Instances.Add(clone); // } }
private static void _copyLayerage(CanvasDevice customDevice, IList <Layerage> children) { foreach (Layerage layerage in children) { LayerageCollection._copyLayerage(customDevice, layerage.Children); // ILayer layer = layerage.Self; ILayer clone = layer.Clone(customDevice); Clipboard.Instances.Add(clone); // } }
private static void _pasteLayerage(CanvasDevice customDevice, IList <Layerage> children) { for (int i = 0; i < children.Count; i++) { Layerage child = children[i]; LayerageCollection._pasteLayerage(customDevice, child.Children); // ILayer child2 = child.ClipboardSelf; ILayer clone2 = child2.Clone(customDevice); Layerage clone = clone2.ToLayerage(); LayerBase.Instances.Add(clone2); // children[i].Id = clone.Id; } }
/// <summary> /// Paste a layerage ( form Clipboard to Layerbase). /// </summary> /// <param name="customDevice"> The custom-device. </param> /// <param name="layerage"> The layerage. </param> public static Layerage PasteLayerage(CanvasDevice customDevice, Layerage layerage) { Layerage child = layerage.Clone(); // ILayer child2 = child.ClipboardSelf; ILayer clone2 = child2.Clone(customDevice); Layerage clone = clone2.ToLayerage(); LayerBase.Instances.Add(clone2); // clone.Children = child.Children; child.Children = null; LayerageCollection._pasteLayerage(customDevice, clone.Children); return(clone); }
private static void PasteLayerageCore(IList <Layerage> children) { for (int i = 0; i < children.Count; i++) { Layerage child = children[i]; LayerManager.PasteLayerageCore(child.Children); // ILayer childCopy = child.ClipboardSelf; ILayer cloneLayer = childCopy.Clone(); Layerage cloneLayerage = Layerage.CreateByGuid(); cloneLayer.Id = cloneLayerage.Id; LayerBase.Instances.Add(cloneLayerage.Id, cloneLayer); // children[i].Id = cloneLayerage.Id; } }
/// <summary> /// Paste a layerage ( form Clipboard to Layerbase). /// </summary> /// <param name="layerage"> The layerage. </param> public static Layerage PasteLayerage(Layerage layerage) { Layerage child = layerage.Clone(); // ILayer childCopy = child.ClipboardSelf; ILayer cloneLayer = childCopy.Clone(); Layerage cloneLayerage = Layerage.CreateByGuid(); cloneLayer.Id = cloneLayerage.Id; LayerBase.Instances.Add(cloneLayerage.Id, cloneLayer); // cloneLayerage.Children = child.Children; child.Children = null; LayerManager.PasteLayerageCore(cloneLayerage.Children); return(cloneLayerage); }