public DenseLayer(Layer layer, int outNodes) { this.layer = layer; InputNodes = layer.OutputNodes; OutputNodes = outNodes; double std = 2.0 / Math.Sqrt(InputNodes); weights = new Variable("weights", ND.Uniform(-std, std, InputNodes, OutputNodes)); biases = new Variable("biases", ND.Zeros <double>(1, OutputNodes)); Function = new AddFunc(new DotFunc(layer.Function, weights), biases); }
public InputLayer(int inNodes) { InputNodes = OutputNodes = inNodes; Function = new Variable("inputs", ND.Zeros <double>(1)); }