2using System.Collections.Generic;
26 [TypeConverter(typeof(ExpandableObjectConverter))]
31 bool m_bEnableNoise =
false;
32 double m_dfSigmaInit = 0.017;
35 uint m_nNumHistoricalSteps = 0;
36 uint m_nNumFutureSteps = 0;
37 bool m_bEnableSelfAttention =
true;
47 [Description(
"Specifies to enable self attention (one input, default = true).")]
50 get {
return m_bEnableSelfAttention; }
51 set { m_bEnableSelfAttention = value; }
57 [Description(
"Specifies the number of historical steps.")]
60 get {
return m_nNumHistoricalSteps; }
61 set { m_nNumHistoricalSteps = value; }
67 [Description(
"Specifies the number of future steps.")]
70 get {
return m_nNumFutureSteps; }
71 set { m_nNumFutureSteps = value; }
77 [Description(
"Specifies the state size corresponding to both the input and output sizes.")]
80 get {
return m_nEmbedDim; }
81 set { m_nEmbedDim = value; }
87 [Description(
"Specifies number of attention heads used in the multi-attention.")]
90 get {
return m_nNumHeads; }
91 set { m_nNumHeads = value; }
100 [Description(
"Enable/disable noise in the inner-product layer (default = false).")]
103 get {
return m_bEnableNoise; }
104 set { m_bEnableNoise = value; }
110 [Description(
"Specifies the initialization value for the sigma weight and sigma bias used when 'enable_noise' = true.")]
113 get {
return m_dfSigmaInit; }
114 set { m_dfSigmaInit = value; }
120 [Category(
"Fillers")]
121 [Description(
"The filler for the weights.")]
124 get {
return m_fillerParam_weights; }
125 set { m_fillerParam_weights = value; }
131 [Category(
"Fillers")]
132 [Description(
"The filler for the bias.")]
135 get {
return m_fillerParam_bias; }
136 set { m_fillerParam_bias = value; }
140 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
163 if (p.m_fillerParam_bias !=
null)
164 m_fillerParam_bias = p.m_fillerParam_bias.
Clone();
166 if (p.m_fillerParam_weights !=
null)
167 m_fillerParam_weights = p.m_fillerParam_weights.
Clone();
169 m_bEnableNoise = p.m_bEnableNoise;
170 m_dfSigmaInit = p.m_dfSigmaInit;
205 rgChildren.
Add(
"enable_noise", m_bEnableNoise.ToString());
206 rgChildren.
Add(
"sigma_init", m_dfSigmaInit.ToString());
209 return new RawProto(strName,
"", rgChildren);
222 if ((strVal = rp.
FindValue(
"enable_self_attention")) !=
null)
225 if ((strVal = rp.
FindValue(
"embed_dim")) !=
null)
228 if ((strVal = rp.
FindValue(
"num_heads")) !=
null)
232 if (rpWeightFiller !=
null)
236 if (rpBiasFiller !=
null)
239 if ((strVal = rp.
FindValue(
"enable_noise")) !=
null)
242 if ((strVal = rp.
FindValue(
"sigma_init")) !=
null)
245 if ((strVal = rp.
FindValue(
"num_historical_steps")) !=
null)
248 if ((strVal = rp.
FindValue(
"num_future_steps")) !=
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.
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the MultiHeadAttentionInterpLayer (Interpretable Multi-Head Attention La...
bool enable_self_attention
Specifies to enable self attention (one input, default = true).
FillerParameter bias_filler
The filler for the bias.
uint num_historical_steps
Specifies the number of historical steps
uint num_future_steps
Specifies the number of future steps
bool enable_noise
Enable/disable noise in the inner-product layer (default = false).
uint num_heads
Specifies number of attention heads used in the multi-attention.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
uint embed_dim
Specifies the state size corresponding to both the input and output sizes.
static MultiHeadAttentionInterpParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
FillerParameter weight_filler
The filler for the weights.
double sigma_init
Specifies the initialization value for the sigma weight and sigma bias used when 'enable_noise' = tru...
MultiHeadAttentionInterpParameter()
Constructor for the parameter.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...