public void DWeights(double[] dvalues, double[] inputs, Layer l, double divisor = 1)
 {
     for (int i = 0; i < DeltaW.GetLength(0); i++)
     {
         for (int j = 0; j < DeltaW.GetLength(1); j++)
         {
             DeltaW[i, j] += (inputs[j] * dvalues[i] * 1 / divisor);
         }
     }
     if (l.L1Regularization > 0)
     {
         Parallel.For(0, l.Weights.GetLength(0), i =>
         {
             Parallel.For(0, l.Weights.GetLength(1), j =>
             {
                 DeltaW[i, j] += l.Weights[i, j] >= 0 ? l.L1Regularization : (-1 * l.L1Regularization);
                 DeltaW[i, j] += 2 * l.L2Regularizattion * l.Weights[i, j];
             });
         });
     }
 }
 public void Reset()
 {
     DeltaB = new double[DeltaB.Count()];
     DeltaW = new double[DeltaW.GetLength(0), DeltaW.GetLength(1)];
 }