/** @copydoc LayerParameterBase::Clone */ public override LayerParameterBase Clone() { LSTMAttentionParameter p = new LSTMAttentionParameter(); p.Copy(this); return(p); }
/** @copydoc LayerParameterBase::Copy */ public override void Copy(LayerParameterBase src) { LSTMAttentionParameter p = (LSTMAttentionParameter)src; m_nNumOutput = p.m_nNumOutput; m_nNumIpOutput = p.m_nNumIpOutput; m_dfClippingThreshold = p.m_dfClippingThreshold; m_fillerWeights = p.m_fillerWeights.Clone(); m_fillerBias = p.m_fillerBias.Clone(); m_bEnableClockworkForgetGateBias = p.m_bEnableClockworkForgetGateBias; m_bEnableAttention = p.m_bEnableAttention; }
/** @copydoc LayerParameterBase::Load */ public override object Load(System.IO.BinaryReader br, bool bNewInstance = true) { RawProto proto = RawProto.Parse(br.ReadString()); LSTMAttentionParameter 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 LSTMAttentionParameter FromProto(RawProto rp) { string strVal; LSTMAttentionParameter p = new LSTMAttentionParameter(); if ((strVal = rp.FindValue("num_output")) != null) { p.num_output = uint.Parse(strVal); } if ((strVal = rp.FindValue("num_output_ip")) != null) { p.num_output_ip = uint.Parse(strVal); } if ((strVal = rp.FindValue("clipping_threshold")) != null) { p.clipping_threshold = ParseDouble(strVal); } RawProto rpWeightFiller = rp.FindChild("weight_filler"); if (rpWeightFiller != null) { p.weight_filler = FillerParameter.FromProto(rpWeightFiller); } RawProto rpBiasFiller = rp.FindChild("bias_filler"); if (rpBiasFiller != null) { p.bias_filler = FillerParameter.FromProto(rpBiasFiller); } if ((strVal = rp.FindValue("enable_clockwork_forgetgate_bias")) != null) { p.enable_clockwork_forgetgate_bias = bool.Parse(strVal); } if ((strVal = rp.FindValue("enable_attention")) != null) { p.enable_attention = bool.Parse(strVal); } return(p); }