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

            p.Copy(this);
            return(p);
        }
        /// <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 ArgMaxParameter FromProto(RawProto rp)
        {
            string          strVal;
            ArgMaxParameter p = new ArgMaxParameter();

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

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

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

            if ((strVal = rp.FindValue("operation")) != null)
            {
                if (strVal == COMPARE_OPERATOR.MIN.ToString())
                {
                    p.operation = COMPARE_OPERATOR.MIN;
                }
                else
                {
                    p.operation = COMPARE_OPERATOR.MAX;
                }
            }

            return(p);
        }
Beispiel #3
0
        /** @copydoc LayerParameterBase::Copy */
        public override void Copy(LayerParameterBase src)
        {
            ArgMaxParameter p = (ArgMaxParameter)src;

            m_bOutMaxVal = p.m_bOutMaxVal;
            m_nTopK      = p.m_nTopK;
            m_nAxis      = p.m_nAxis;
        }
Beispiel #4
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto        proto = RawProto.Parse(br.ReadString());
            ArgMaxParameter p     = FromProto(proto);

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

            return(p);
        }
Beispiel #5
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 ArgMaxParameter FromProto(RawProto rp)
        {
            string          strVal;
            ArgMaxParameter p = new ArgMaxParameter();

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

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

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

            return(p);
        }