2using System.Collections.Generic;
27 [TypeConverter(typeof(ExpandableObjectConverter))]
31 uint m_nNumIpOutput = 0;
32 double m_dfClippingThreshold = 0;
35 bool m_bEnableClockworkForgetGateBias =
false;
36 bool m_bEnableAttention =
false;
46 [Description(
"Specifies the number of outputs for the layer.")]
49 get {
return m_nNumOutput; }
50 set { m_nNumOutput = value; }
56 [Description(
"Specifies the number of outputs for the layer. Note, whenb 0, no inner product is performed.")]
59 get {
return m_nNumIpOutput; }
60 set { m_nNumIpOutput = value; }
66 [Description(
"Specifies the gradient clipping threshold, default = 0.0 (i.e. no clipping).")]
69 get {
return m_dfClippingThreshold; }
70 set { m_dfClippingThreshold = value; }
76 [Description(
"Specifies the filler parameters for the weight filler.")]
77 [TypeConverter(typeof(ExpandableObjectConverter))]
80 get {
return m_fillerWeights; }
81 set { m_fillerWeights = value; }
87 [Description(
"Specifies the filler parameters for the bias filler.")]
88 [TypeConverter(typeof(ExpandableObjectConverter))]
91 get {
return m_fillerBias; }
92 set { m_fillerBias = value; }
101 [Description(
"When true, the forget gate bias is set to 5.0 as recommended by [1] Koutnik, J., Greff, K., Gomez, F., Schmidhuber, J., 'A Clockwork RNN', 2014")]
104 get {
return m_bEnableClockworkForgetGateBias; }
105 set { m_bEnableClockworkForgetGateBias = value; }
112 [Description(
"When enabled, attention is applied to the input state on each cycle through the LSTM. Attention is used with encoder/decoder models.")]
115 get {
return m_bEnableAttention; }
116 set { m_bEnableAttention = value; }
120 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
136 m_nNumOutput = p.m_nNumOutput;
137 m_nNumIpOutput = p.m_nNumIpOutput;
138 m_dfClippingThreshold = p.m_dfClippingThreshold;
139 m_fillerWeights = p.m_fillerWeights.
Clone();
140 m_fillerBias = p.m_fillerBias.
Clone();
141 m_bEnableClockworkForgetGateBias = p.m_bEnableClockworkForgetGateBias;
142 m_bEnableAttention = p.m_bEnableAttention;
162 rgChildren.
Add(
"num_output", m_nNumOutput.ToString());
163 rgChildren.
Add(
"num_output_ip", m_nNumIpOutput.ToString());
165 if (m_dfClippingThreshold != 0)
166 rgChildren.
Add(
"clipping_threshold", m_dfClippingThreshold.ToString());
168 rgChildren.
Add(m_fillerWeights.
ToProto(
"weight_filler"));
169 rgChildren.
Add(m_fillerBias.
ToProto(
"bias_filler"));
171 if (m_bEnableClockworkForgetGateBias !=
false)
172 rgChildren.
Add(
"enable_clockwork_forgetgate_bias", m_bEnableClockworkForgetGateBias.ToString());
174 rgChildren.
Add(
"enable_attention", m_bEnableAttention.ToString());
176 return new RawProto(strName,
"", rgChildren);
189 if ((strVal = rp.
FindValue(
"num_output")) !=
null)
192 if ((strVal = rp.
FindValue(
"num_output_ip")) !=
null)
195 if ((strVal = rp.
FindValue(
"clipping_threshold")) !=
null)
199 if (rpWeightFiller !=
null)
203 if (rpBiasFiller !=
null)
206 if ((strVal = rp.
FindValue(
"enable_clockwork_forgetgate_bias")) !=
null)
209 if ((strVal = rp.
FindValue(
"enable_attention")) !=
null)
static double ParseDouble(string strVal)
Parse double values using the US culture if the decimal separator = '.', then using the native cultur...
The RawProtoCollection class is a list of RawProto objects.
void Add(RawProto p)
Adds a RawProto to the collection.
The RawProto class is used to parse and output Google prototxt file data.
RawProto FindChild(string strName)
Searches for a given node.
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
Specifies the filler parameters used to create each Filler.
static FillerParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
FillerParameter Clone()
Creates a new copy of this instance of the parameter.
Specifies the parameters for the LSTMAttentionLayer that provides an attention based LSTM layer used ...
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
LSTMAttentionParameter()
Constructor for the parameter.
double clipping_threshold
Specifies the gradient clipping threshold, default = 0.0 (i.e. no clipping).
override void Copy(LayerParameterBase src)
Copy on parameter to another.
static LSTMAttentionParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
bool enable_clockwork_forgetgate_bias
When enabled, the forget gate bias is set to 5.0.
uint num_output_ip
Specifies the number of IP outputs for the layer. Note, when 0, no inner product is performed.
FillerParameter bias_filler
Specifies the filler parameters for the bias filler.
FillerParameter weight_filler
Specifies the filler parameters for the weight filler.
uint num_output
Specifies the number of outputs for the layer.
bool enable_attention
(default=false) When enabled, attention is applied to the input state on each cycle through the LSTM....
The LayerParameterBase is the base class for all other layer specific parameters.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.param namespace contains parameters used to create models.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...