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

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

            m_rgFillers  = Utility.Clone <FillerParameter>(p.m_rgFillers);
            m_rgShape    = Utility.Clone <BlobShape>(p.m_rgShape);
            m_rgNum      = Utility.Clone <uint>(p.m_rgNum);
            m_rgChannels = Utility.Clone <uint>(p.m_rgChannels);
            m_rgHeight   = Utility.Clone <uint>(p.m_rgHeight);
            m_rgWidth    = Utility.Clone <uint>(p.m_rgWidth);
        }
예제 #3
0
        /** @copydoc LayerParameterBase::Load */
        public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
        {
            RawProto           proto = RawProto.Parse(br.ReadString());
            DummyDataParameter 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 DummyDataParameter FromProto(RawProto rp)
        {
            DummyDataParameter p = new DummyDataParameter();
            RawProtoCollection rgp;

            rgp = rp.FindChildren("data_filler");
            foreach (RawProto child in rgp)
            {
                p.data_filler.Add(FillerParameter.FromProto(child));
            }

            rgp = rp.FindChildren("shape");
            foreach (RawProto child in rgp)
            {
                p.shape.Add(BlobShape.FromProto(child));
            }

            p.num      = rp.FindArray <uint>("num");
            p.channels = rp.FindArray <uint>("channels");
            p.height   = rp.FindArray <uint>("height");
            p.width    = rp.FindArray <uint>("width");

            string strVal;

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

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

            return(p);
        }
예제 #5
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 DummyDataParameter FromProto(RawProto rp)
        {
            DummyDataParameter p = new DummyDataParameter();
            RawProtoCollection rgp;

            rgp = rp.FindChildren("data_filler");
            foreach (RawProto child in rgp)
            {
                p.data_filler.Add(FillerParameter.FromProto(child));
            }

            rgp = rp.FindChildren("shape");
            foreach (RawProto child in rgp)
            {
                p.shape.Add(BlobShape.FromProto(child));
            }

            p.num      = rp.FindArray <uint>("num");
            p.channels = rp.FindArray <uint>("channels");
            p.height   = rp.FindArray <uint>("height");
            p.width    = rp.FindArray <uint>("width");

            return(p);
        }