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

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

            m_nOutput            = p.m_nOutput;
            m_nK                 = p.m_nK;
            m_nMaxBatchesToStore = p.m_nMaxBatchesToStore;
        }
Пример #3
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto     proto = RawProto.Parse(br.ReadString());
            KnnParameter 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 KnnParameter FromProto(RawProto rp)
        {
            string       strVal;
            KnnParameter p = new KnnParameter();

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

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

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

            return(p);
        }