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

            p.Copy(this);
            return(p);
        }
Пример #2
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto           proto = RawProto.Parse(br.ReadString());
            HingeLossParameter p     = FromProto(proto);

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

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

            if ((strVal = rp.FindValue("norm")) != null)
            {
                switch (strVal)
                {
                case "L1":
                    p.norm = Norm.L1;
                    break;

                case "L2":
                    p.norm = Norm.L2;
                    break;

                default:
                    throw new Exception("Unknown 'norm' value: " + strVal);
                }
            }

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

            m_norm = p.m_norm;
        }