Exemplo n.º 1
0
        private void UpdateWeightsTensor(WeightTensor m, int batchSize, float step_size, float regc, int iter)
        {
            try
            {
                //float clip_coef = 1.0f;

                //float normVal = Ops.NormAll(m.TGradient, 2.0f);
                //float clip_coef = 0.5f / (normVal + 1e-6f);
                //if (clip_coef > 1.0f)
                //{
                //    clip_coef = 1.0f;
                //}

                Ops.Adam(m.TWeight, m.TGradient, m_cacheName2V[m.Name], m_cacheName2M[m.Name], batchSize, step_size, m_clipval, regc, m_beta2, m_beta1, iter, m_smoothEps);
            }
            catch (Exception err)
            {
                Logger.WriteLine(Logger.Level.err, $"Exception: '{err.Message}'");
                Logger.WriteLine(Logger.Level.err, $"Call stack: '{err.StackTrace}'");

                throw;
            }
        }
Exemplo n.º 2
0
 private void UpdateWeightsTensor(WeightTensor m, int batchSize, float step_size, float clipval, float regc, int iter)
 {
     // Ops.RMSProp(m.TWeight, m.TGradient, m.TV, batchSize, step_size, clipval, regc, decay_rate, smooth_eps);
     Ops.Adam(m.TWeight, m.TGradient, m_cacheName2V[m.Name], m_cacheName2M[m.Name], batchSize, step_size, clipval, regc, m_beta2, m_beta1, iter, m_smoothEps);
 }