Example #1
0
        /// <summary>
        /// Creates a new copy of this instance of the parameter.
        /// </summary>
        /// <returns>A new instance of this parameter is returned.</returns>
        public override LayerParameterBase Clone()
        {
            DataSequenceParameter p = new DataSequenceParameter();

            p.Copy(this);
            return(p);
        }
Example #2
0
        /// <summary>
        /// Copy on parameter to another.
        /// </summary>
        /// <param name="src">Specifies the parameter to copy.</param>
        public override void Copy(LayerParameterBase src)
        {
            DataSequenceParameter p = (DataSequenceParameter)src;

            m_nCacheSize      = p.m_nCacheSize;
            m_nK              = p.m_nK;
            m_bOutputLabels   = p.m_bOutputLabels;
            m_nLabelStart     = p.m_nLabelStart;
            m_nLabelCount     = p.m_nLabelCount;
            m_bBalanceMatches = p.m_bBalanceMatches;
        }
Example #3
0
        /// <summary>
        /// Load the parameter from a binary reader.
        /// </summary>
        /// <param name="br">Specifies the binary reader.</param>
        /// <param name="bNewInstance">When <i>true</i> a new instance is created (the default), otherwise the existing instance is loaded from the binary reader.</param>
        /// <returns>Returns an instance of the parameter.</returns>
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto proto          = RawProto.Parse(br.ReadString());
            DataSequenceParameter p = FromProto(proto);

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

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

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

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

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

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

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

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

            return(p);
        }