コード例 #1
0
ファイル: GramParameter.cs プロジェクト: maplewei/MyCaffe
        /// <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 GramParameter FromProto(RawProto rp)
        {
            string        strVal;
            GramParameter p = new GramParameter();

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

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

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

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

            return(p);
        }
コード例 #2
0
ファイル: GramParameter.cs プロジェクト: maplewei/MyCaffe
        /** @copydoc LayerParameterBase::Copy */
        public override void Copy(LayerParameterBase src)
        {
            GramParameter p = (GramParameter)src;

            m_nAxis   = p.m_nAxis;
            m_dfAlpha = p.m_dfAlpha;
            m_dfBeta  = p.m_dfBeta;
            m_bDisableScalingOnGradient = p.m_bDisableScalingOnGradient;
        }
コード例 #3
0
ファイル: GramParameter.cs プロジェクト: maplewei/MyCaffe
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto      proto = RawProto.Parse(br.ReadString());
            GramParameter p     = FromProto(proto);

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

            return(p);
        }