//公有方法 public new List <float> GetOutput() { //耗时计算 Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); List <float> output = new List <float>(); //平化操作 if (this.Input != null) { if (this.Input.GetType() == typeof(ConvLayer)) { ConvLayer input = Input; var inputs = input.GetOutput(); for (int n = 0; n < inputs.Count; n++) { for (int i = 0; i < inputs[n].GetLength(0); i++) { for (int j = 0; j < inputs[n].GetLength(1); j++) { output.Add(inputs[n][i, j]); } } } } } //打印 stopwatch.Stop(); if (this.Father.__debug__) { Console.WriteLine("{0}用时(毫秒):{1}", this.Name, stopwatch.ElapsedMilliseconds); } return(output); }
public void Create(int kernel_num, int kernel_size, int step = 1, string name = "conv", string padding = "same", string activation = "relu", string optimizer = "GD") { ConvLayer layer; if (this.Layers.Count == 0) { layer = new ConvLayer(kernel_num, kernel_size, step, null, name, padding, activation, optimizer); } else { layer = new ConvLayer(kernel_num, kernel_size, step, this.Layers.Last(), name, padding, activation, optimizer); } Add(layer); }
public void Add(ConvLayer layer) { this.Layers.Add(layer); layer.Father = this;//设置父对象 Update(); }