/// <summary> /// Creates a new copy of this instance of the parameter. /// </summary> /// <returns>A new instance of this parameter is returned.</returns> public override LayerParameterBase Clone() { UnPoolingParameter p = new UnPoolingParameter(); p.Copy(this); return(p); }
/// <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 new UnPoolingParameter FromProto(RawProto rp) { UnPoolingParameter p = new UnPoolingParameter(); ((PoolingParameter)p).Copy(PoolingParameter.FromProto(rp)); p.m_rgUnpool = rp.FindArray <uint>("unpool_size"); p.m_nUnPoolH = (uint?)rp.FindValue("unpool_h", typeof(uint)); p.m_nUnPoolW = (uint?)rp.FindValue("unpool_w", typeof(uint)); return(p); }
/// <summary> /// Copy on parameter to another. /// </summary> /// <param name="src">Specifies the parameter to copy.</param> public override void Copy(LayerParameterBase src) { base.Copy(src); if (src is UnPoolingParameter) { UnPoolingParameter p = (UnPoolingParameter)src; m_rgUnpool = Utility.Clone <uint>(p.m_rgUnpool); m_nUnPoolH = p.m_nUnPoolH; m_nUnPoolW = p.m_nUnPoolW; } }
/// <summary> /// Load the parameter from a binary reader. /// </summary> /// <param name="br">Specifies the binary reader.</param> /// <param name="bNewInstance">When <i>true</i> a new instance is created (the default), otherwise the existing instance is loaded from the binary reader.</param> /// <returns>Returns an instance of the parameter.</returns> public override object Load(System.IO.BinaryReader br, bool bNewInstance = true) { RawProto proto = RawProto.Parse(br.ReadString()); UnPoolingParameter p = FromProto(proto) as UnPoolingParameter; if (p == null) { throw new Exception("Expected UnPoolingParameter type!"); } if (!bNewInstance) { Copy(p); } return(p); }