Exemplo n.º 1
0
        /** @copydoc LayerParameterBase::Clone */
        public override LayerParameterBase Clone()
        {
            BiasParameter p = new BiasParameter();

            p.Copy(this);
            return(p);
        }
Exemplo n.º 2
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto      proto = RawProto.Parse(br.ReadString());
            BiasParameter p     = FromProto(proto);

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

            return(p);
        }
Exemplo n.º 3
0
        /** @copydoc LayerParameterBase::Copy */
        public override void Copy(LayerParameterBase src)
        {
            BiasParameter p = (BiasParameter)src;

            m_nAxis    = p.m_nAxis;
            m_nNumAxes = p.m_nNumAxes;

            if (p.m_filler != null)
            {
                m_filler = p.m_filler.Clone();
            }
            else
            {
                m_filler = null;
            }
        }
Exemplo n.º 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 BiasParameter FromProto(RawProto rp)
        {
            string        strVal;
            BiasParameter p = new BiasParameter();

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

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

            if ((rp = rp.FindChild("filler")) != null)
            {
                p.m_filler = FillerParameter.FromProto(rp);
            }

            return(p);
        }