/// <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 MathParameter FromProto(RawProto rp) { string strVal; MathParameter p = new MathParameter(); if ((strVal = rp.FindValue("function")) != null) { if (strVal == MyCaffe.common.MATH_FUNCTION.COS.ToString()) { p.function = MyCaffe.common.MATH_FUNCTION.COS; } else if (strVal == MyCaffe.common.MATH_FUNCTION.SIN.ToString()) { p.function = MyCaffe.common.MATH_FUNCTION.SIN; } else if (strVal == MyCaffe.common.MATH_FUNCTION.TAN.ToString()) { p.function = MyCaffe.common.MATH_FUNCTION.TAN; } else { p.function = MyCaffe.common.MATH_FUNCTION.NOP; } } return(p); }
/** @copydoc LayerParameterBase::Clone */ public override LayerParameterBase Clone() { MathParameter p = new MathParameter(); p.Copy(this); return(p); }
/** @copydoc LayerParameterBase::Load */ public override object Load(System.IO.BinaryReader br, bool bNewInstance = true) { RawProto proto = RawProto.Parse(br.ReadString()); MathParameter p = FromProto(proto); if (!bNewInstance) { Copy(p); } return(p); }
/** @copydoc LayerParameterBase::Copy */ public override void Copy(LayerParameterBase src) { MathParameter p = (MathParameter)src; m_function = p.m_function; }