Пример #1
0
        /** @copydoc LayerParameterBase::Clone */
        public override LayerParameterBase Clone()
        {
            MVNParameter p = new MVNParameter();

            p.Copy(this);
            return(p);
        }
Пример #2
0
        /** @copydoc LayerParameterBase::Copy */
        public override void Copy(LayerParameterBase src)
        {
            MVNParameter p = (MVNParameter)src;

            m_bNormalizeVariance = p.m_bNormalizeVariance;
            m_bAcrossChannels    = p.m_bAcrossChannels;
            m_dfEps = p.m_dfEps;
        }
Пример #3
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto     proto = RawProto.Parse(br.ReadString());
            MVNParameter p     = FromProto(proto);

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

            return(p);
        }
Пример #4
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 MVNParameter FromProto(RawProto rp)
        {
            string       strVal;
            MVNParameter p = new MVNParameter();

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

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

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

            return(p);
        }