예제 #1
0
        void _cal(Matrix <double> i, int layIndex)
        {
            if (layIndex >= mNNlayers.Count)
            {
                return;
            }
            CNNLayer lay = mNNlayers[layIndex];

            lay.cal(i);
            layIndex++;
            _cal(lay.mA, layIndex);
        }
예제 #2
0
 void reserveCal()
 {
     for (int i = mNNlayers.Count - 1; i >= 0; i--)
     {
         CNNLayer lay = mNNlayers[i];
         if (mNNlayers.Count - 1 == i)
         {
             lay.mDW = Matrix <double> .Build.Dense(lay.mNodeNum, 1, getDeviationDerivative() *lay.getActiveDerivative());
         }
         else
         {
             CNNLayer afterLay = mNNlayers[i + 1];
             lay.mDW = afterLay.mDW * afterLay.mW * lay.getActiveDerivative();
         }
     }
 }
예제 #3
0
        void updateWB(Matrix <double> inSample)
        {
            for (int i = 0; i < mNNlayers.Count; i++)
            {
                CNNLayer        lay = mNNlayers[i];
                Matrix <double> preIn;
                if (i == 0)
                {
                    preIn = inSample;
                }
                else
                {
                    preIn = lay.mA;
                }
                Matrix <double> dw = preIn * lay.mDW;
                Matrix <double> db = lay.mDW;

                lay.mW -= mU * dw;
                lay.mB -= mU * db;
            }
        }