Exemple #1
0
        /** @copydoc LayerParameterBase::Clone */
        public override LayerParameterBase Clone()
        {
            ReinforcementLossParameter p = new ReinforcementLossParameter();

            p.Copy(this);
            return(p);
        }
Exemple #2
0
        /// <summary>
        /// Parses the parameter from a RawProto.
        /// </summary>
        /// <param name="rp">Specifies the RawProto to parse.</param>
        /// <returns>A new instance of the parameter is returned.</returns>
        public static ReinforcementLossParameter FromProto(RawProto rp)
        {
            string strVal;
            ReinforcementLossParameter p = new ReinforcementLossParameter();

            if ((strVal = rp.FindValue("discount_rate")) != null)
            {
                p.discount_rate = double.Parse(strVal);
            }

            if ((strVal = rp.FindValue("exploration_rate_start")) != null)
            {
                p.exploration_rate_start = double.Parse(strVal);
            }

            if ((strVal = rp.FindValue("exploration_rate_end")) != null)
            {
                p.exploration_rate_end = double.Parse(strVal);
            }

            if ((strVal = rp.FindValue("exploration_rate_decay")) != null)
            {
                p.exploration_rate_decay = double.Parse(strVal);
            }

            if ((strVal = rp.FindValue("training_step")) != null)
            {
                p.training_step = uint.Parse(strVal);
            }

            return(p);
        }
Exemple #3
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto proto = RawProto.Parse(br.ReadString());
            ReinforcementLossParameter p = FromProto(proto);

            if (!bNewInstance)
            {
                Copy(p);
            }

            return(p);
        }
Exemple #4
0
 /** @copydoc LayerParameterBase::Copy */
 public override void Copy(LayerParameterBase src)
 {
     if (src is ReinforcementLossParameter)
     {
         ReinforcementLossParameter p = (ReinforcementLossParameter)src;
         m_colBatchInfo           = p.m_colBatchInfo;
         m_dfDiscount             = p.m_dfDiscount;
         m_dfExplorationRateStart = p.m_dfExplorationRateStart;
         m_dfExplorationRateEnd   = p.m_dfExplorationRateEnd;
         m_dfExplorationRateDecay = p.m_dfExplorationRateDecay;
         m_nTrainingStep          = p.m_nTrainingStep;
     }
 }