Beispiel #1
0
        /** @copydoc LayerParameterBase::Clone */
        public override LayerParameterBase Clone()
        {
            SliceParameter p = new SliceParameter();

            p.Copy(this);
            return(p);
        }
Beispiel #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;
        }
Beispiel #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);
        }
Beispiel #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);
        }