示例#1
0
        /** @copydoc LayerParameterBase::Clone */
        public override LayerParameterBase Clone()
        {
            OneHotParameter p = new OneHotParameter();

            p.Copy(this);
            return(p);
        }
示例#2
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 OneHotParameter FromProto(RawProto rp)
        {
            string          strVal;
            OneHotParameter p = new OneHotParameter();

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

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

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

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

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

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

            m_nAxis      = p.m_nAxis;
            m_nNumOutput = p.m_nNumOutput;
            m_dfMin      = p.m_dfMin;
            m_dfMax      = p.m_dfMax;
            m_nMinAxes   = p.m_nMinAxes;
        }
示例#4
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto        proto = RawProto.Parse(br.ReadString());
            OneHotParameter p     = FromProto(proto);

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

            return(p);
        }