/** @copydoc LayerParameterBase::Clone */ public override LayerParameterBase Clone() { ContrastiveLossParameter p = new ContrastiveLossParameter(); p.Copy(this); return(p); }
/** @copydoc LayerParameterBase::Copy */ public override void Copy(LayerParameterBase src) { ContrastiveLossParameter p = (ContrastiveLossParameter)src; m_dfMargin = p.m_dfMargin; m_bLegacyVersion = p.m_bLegacyVersion; }
/** @copydoc LayerParameterBase::Copy */ public override void Copy(LayerParameterBase src) { ContrastiveLossParameter p = (ContrastiveLossParameter)src; m_dfMargin = p.m_dfMargin; m_bLegacyVersion = p.m_bLegacyVersion; m_bOutputMatches = p.m_bOutputMatches; m_centroidLearning = p.m_centroidLearning; m_distanceCalc = p.m_distanceCalc; m_dfMatchingDistScale = p.m_dfMatchingDistScale; }
/** @copydoc LayerParameterBase::Load */ public override object Load(System.IO.BinaryReader br, bool bNewInstance = true) { RawProto proto = RawProto.Parse(br.ReadString()); ContrastiveLossParameter 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 ContrastiveLossParameter FromProto(RawProto rp) { string strVal; ContrastiveLossParameter p = new ContrastiveLossParameter(); if ((strVal = rp.FindValue("margin")) != null) { p.margin = double.Parse(strVal); } if ((strVal = rp.FindValue("legacy_version")) != null) { p.legacy_version = bool.Parse(strVal); } if ((strVal = rp.FindValue("output_matches")) != null) { p.output_matches = bool.Parse(strVal); } if ((strVal = rp.FindValue("centroid_learning")) != null) { if (strVal == CENTROID_LEARNING.ALL.ToString()) { p.centroid_learning = CENTROID_LEARNING.ALL; } else if (strVal == CENTROID_LEARNING.MATCHING.ToString()) { p.centroid_learning = CENTROID_LEARNING.MATCHING; } else if (strVal == CENTROID_LEARNING.NONMATCHING.ToString()) { p.centroid_learning = CENTROID_LEARNING.NONMATCHING; } } if ((strVal = rp.FindValue("distance_calculation")) != null) { if (strVal == DISTANCE_CALCULATION.MANHATTAN.ToString()) { p.distance_calculation = DISTANCE_CALCULATION.MANHATTAN; } } if ((strVal = rp.FindValue("matching_distance_scale")) != null) { p.matching_distance_scale = double.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 ContrastiveLossParameter FromProto(RawProto rp) { string strVal; ContrastiveLossParameter p = new ContrastiveLossParameter(); if ((strVal = rp.FindValue("margin")) != null) { p.margin = double.Parse(strVal); } if ((strVal = rp.FindValue("legacy_version")) != null) { p.legacy_version = bool.Parse(strVal); } return(p); }