Ejemplo n.º 1
0
 /// <summary>
 /// Create learning rate time decay operation.
 /// </summary>
 protected TFOutput CreateDecayOps(float decay, TFOutput initialLearningRate)
 {
     if (decay > 0)
     {
         var _decay = _graph.Const(decay, "Decay");
         var one    = _graph.Const(1f);
         return
             (_graph.Mul(initialLearningRate,
                         _graph.Div(one,
                                    _graph.Add(one,
                                               _graph.Mul(_decay,
                                                          _graph.Cast(_graph.Sub(Iterations.ReadAfter(_graph.CurrentDependencies), _graph.Const(1L)), _decay.OutputType)
                                                          )
                                               )
                                    ), operName: "learningrate"
                         ));
     }
     else
     {
         return(initialLearningRate);
     }
 }