public override void InitRandomWeight(Random rand) { // Xavier weight filling * _outChannels float wconv1 = (float)Math.Sqrt(3.0f / (_filterX * _filterY * _inChannels)); float[] w = new float[_weights.Size]; float[] b = new float[_bias.Size]; // Randomize network for (int i = 0; i < _weights.Size; i++) { w[i] = (float)((rand.NextDouble() * 2.0 - 1.0) * wconv1); } for (int i = 0; i < _bias.Size; i++) { b[i] = (float)((rand.NextDouble() * 2.0 - 1.0) * wconv1); } _weights.CopyToDevice(w); _bias.CopyToDevice(b); switch (_activation) { case Activation.PRelu: _aRelu.Set(0.25f); break; case Activation.LeakyRelu: _aRelu.Set(0.25f); break; default: break; } base.InitRandomWeight(rand); }