/** @copydoc LayerParameterBase::Clone */ public override LayerParameterBase Clone() { TextDataParameter p = new TextDataParameter(); 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()); TextDataParameter p = FromProto(proto); if (!bNewInstance) { Copy(p); } return(p); }
/** @copydoc LayerParameterBase::Copy */ public override void Copy(LayerParameterBase src) { TextDataParameter p = (TextDataParameter)src; m_strEncoderSource = p.m_strEncoderSource; m_strDecoderSource = p.m_strDecoderSource; m_nBatchSize = p.m_nBatchSize; m_nTimeSteps = p.m_nTimeSteps; m_nSampleSize = p.m_nSampleSize; m_bShuffle = p.m_bShuffle; m_bEnableNormalEncoderOutput = p.m_bEnableNormalEncoderOutput; m_bEnableReverseEncoderOutput = p.m_bEnableReverseEncoderOutput; }
/// <summary> /// Parses the parameter from a RawProto. /// </summary> /// <param name="rp">Specifies the RawProto to parse.</param> /// <param name="p">Optionally, specifies an instance to load. If <i>null</i>, a new instance is created and loaded.</param> /// <returns>A new instance of the parameter is returned.</returns> public static TextDataParameter FromProto(RawProto rp, TextDataParameter p = null) { string strVal; if (p == null) { p = new TextDataParameter(); } if ((strVal = rp.FindValue("encoder_source")) != null) { p.encoder_source = strVal.Trim('\"'); } if ((strVal = rp.FindValue("decoder_source")) != null) { p.decoder_source = strVal.Trim('\"'); } if ((strVal = rp.FindValue("batch_size")) != null) { p.batch_size = uint.Parse(strVal); } if ((strVal = rp.FindValue("time_steps")) != null) { p.time_steps = uint.Parse(strVal); } if ((strVal = rp.FindValue("shuffle")) != null) { p.shuffle = bool.Parse(strVal); } if ((strVal = rp.FindValue("enable_normal_encoder_output")) != null) { p.enable_normal_encoder_output = bool.Parse(strVal); } if ((strVal = rp.FindValue("enable_reverse_encoder_output")) != null) { p.enable_reverse_encoder_output = bool.Parse(strVal); } return(p); }