예제 #1
0
        /** @copydoc LayerParameterBase::Clone */
        public override LayerParameterBase Clone()
        {
            ReshapeParameter p = new ReshapeParameter();

            p.Copy(this);
            return(p);
        }
예제 #2
0
        /** @copydoc LayerParameterBase::Copy */
        public override void Copy(LayerParameterBase src)
        {
            ReshapeParameter p = (ReshapeParameter)src;

            if (p.m_shape != null)
            {
                m_shape = p.m_shape.Clone();
            }

            m_nAxis    = p.m_nAxis;
            m_nNumAxes = p.m_nNumAxes;
        }
예제 #3
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto         proto = RawProto.Parse(br.ReadString());
            ReshapeParameter 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 ReshapeParameter FromProto(RawProto rp)
        {
            string           strVal;
            ReshapeParameter p = new ReshapeParameter();

            RawProto rpShape = rp.FindChild("shape");

            if (rpShape != null)
            {
                p.shape = BlobShape.FromProto(rpShape);
            }

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

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

            return(p);
        }