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

            p.Copy(this);
            return(p);
        }
Esempio n. 2
0
        /** @copydoc LayerParameterBase::Copy */
        public override void Copy(LayerParameterBase src)
        {
            SliceParameter p = (SliceParameter)src;

            m_nAxis        = p.m_nAxis;
            m_rgSlicePoint = Utility.Clone <uint>(p.m_rgSlicePoint);
            m_nSliceDim    = p.m_nSliceDim;
        }
Esempio n. 3
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto       proto = RawProto.Parse(br.ReadString());
            SliceParameter p     = FromProto(proto);

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

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

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

            p.slice_point = rp.FindArray <uint>("slice_point");

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

            return(p);
        }