/** @copydoc LayerParameterBase::Clone */ public override LayerParameterBase Clone() { AccuracyParameter p = new AccuracyParameter(); p.Copy(this); return(p); }
/** @copydoc LayerParameterBase::Copy */ public override void Copy(LayerParameterBase src) { AccuracyParameter p = (AccuracyParameter)src; m_nTopK = p.m_nTopK; m_nAxis = p.m_nAxis; m_nIgnoreLabel = p.m_nIgnoreLabel; }
/** @copydoc LayerParameterBase::Copy */ public override void Copy(LayerParameterBase src) { AccuracyParameter p = (AccuracyParameter)src; m_nTopK = p.m_nTopK; m_nAxis = p.m_nAxis; m_rgnIgnoreLabel = Utility.Clone <int>(p.m_rgnIgnoreLabel); }
/** @copydoc LayerParameterBase::Load */ public override object Load(System.IO.BinaryReader br, bool bNewInstance = true) { RawProto proto = RawProto.Parse(br.ReadString()); AccuracyParameter p = FromProto(proto); if (!bNewInstance) { Copy(p); } 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 AccuracyParameter FromProto(RawProto rp) { string strVal; AccuracyParameter p = new AccuracyParameter(); if ((strVal = rp.FindValue("top_k")) != null) { p.top_k = uint.Parse(strVal); } if ((strVal = rp.FindValue("axis")) != null) { p.axis = int.Parse(strVal); } if ((strVal = rp.FindValue("ignore_label")) != null) { p.ignore_label = int.Parse(strVal); } 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 AccuracyParameter FromProto(RawProto rp) { string strVal; AccuracyParameter p = new AccuracyParameter(); if ((strVal = rp.FindValue("top_k")) != null) { p.top_k = uint.Parse(strVal); } if ((strVal = rp.FindValue("axis")) != null) { p.axis = int.Parse(strVal); } if ((strVal = rp.FindValue("ignore_label")) != null) { p.ignore_labels.Clear(); p.ignore_labels.Add(int.Parse(strVal)); } if ((strVal = rp.FindValue("ignore_labels")) != null) { p.ignore_labels.Clear(); string[] rgstr = strVal.Trim(' ', '{', '}').Split(','); foreach (string str in rgstr) { if (!string.IsNullOrEmpty(str)) { p.ignore_labels.Add(int.Parse(str)); } } } return(p); }