2using System.Collections.Generic;
7using System.Threading.Tasks;
16 [TypeConverter(typeof(ExpandableObjectConverter))]
19 uint m_nNumOutput = 0;
22 bool m_bDebugInfo =
false;
23 bool m_bExposeHiddenInput =
false;
24 bool m_bExposeHiddenOutput =
false;
25 uint m_nNumLayers = 1;
26 double m_dfDropoutRatio = 0.0;
27 long m_lDropoutSeed = 0;
28 bool m_bBidirectional =
false;
29 bool m_bCudnnEnableTensorCores =
false;
30 bool m_bBatchFirst =
false;
31 bool m_bAutoRepeatHiddenStatesAcrossLayers =
false;
32 bool m_bUseCudnnRnn8IfSupported =
false;
46 return "The engine setting is set on CAFFE or DEFAULT.";
56 get {
return m_bUseCudnnRnn8IfSupported; }
57 set { m_bUseCudnnRnn8IfSupported = value; }
63 [Description(
"Auto repeat the hidden and cell states so that a separate state is fed to each layer.")]
66 get {
return m_bAutoRepeatHiddenStatesAcrossLayers; }
67 set { m_bAutoRepeatHiddenStatesAcrossLayers = value; }
73 [Description(
"The input and outputs are shaped with the batch in the first dimension.")]
76 get {
return m_bBatchFirst; }
77 set { m_bBatchFirst = value; }
98 [Description(
"Specifies whether the network is bidirectional (<i>true</i>) or unidirectional (<i>false</i> - default).")]
101 get {
return m_bBidirectional; }
102 set { m_bBidirectional = value; }
109 [Description(
"Specifies the dimension of the output (and usually hidden state) representation -- must be explicitly set to non-zero.")]
112 get {
return m_nNumOutput; }
113 set { m_nNumOutput = value; }
119 [Description(
"Specifies the filler for the weights.")]
122 get {
return m_weight_filler; }
123 set { m_weight_filler = value; }
129 [Description(
"Specifies the filler for the bias.")]
132 get {
return m_bias_filler; }
133 set { m_bias_filler = value; }
139 [Description(
"Specifies whether to enable displaying debug info in the unrolled recurrent net.")]
142 get {
return m_bDebugInfo; }
143 set { m_bDebugInfo = value; }
151 [Description(
"Specifies whether to add as additional inputs (bottoms) the initial hidden state blobs. The number of additional bottom/top blobs required depends on the recurrent architecture -- e.g., 1 for RNN's, 2 for LSTM's.")]
154 get {
return m_bExposeHiddenInput; }
155 set { m_bExposeHiddenInput = value; }
163 [Description(
"Specifies whether to add as additional outputs (tops) the final timestep hidden state blobs. The number of additional bottom/top blobs required depends on the recurrent architecture -- e.g., 1 for RNN's, 2 for LSTM's.")]
166 get {
return m_bExposeHiddenOutput; }
167 set { m_bExposeHiddenOutput = value; }
174 [Description(
"Specifies the number of LSTM layers to implement (cuDnn only).")]
177 get {
return m_nNumLayers; }
178 set { m_nNumLayers = value; }
185 [Description(
"Specifies the dropout ratio (cuDnn only). (e.g. the probability that values will be dropped out and set to zero. A value of 0.25 = 25% chance that a value is set to 0, and dropped out.)")]
188 get {
return m_dfDropoutRatio; }
189 set { m_dfDropoutRatio = value; }
196 [Description(
"Specifies the random number generator seed used with the cuDnn dropout - the default value of '0' uses a random seed (cuDnn only).")]
199 get {
return m_lDropoutSeed; }
200 set { m_lDropoutSeed = value; }
209 [Description(
"Specifies to enable CUDA tensor cores when performing the rnn operations which is faster but not supported by all GPU's. When not supported, the default math is used.")]
212 get {
return m_bCudnnEnableTensorCores; }
213 set { m_bCudnnEnableTensorCores = value; }
217 public override object Load(BinaryReader br,
bool bNewInstance =
true)
254 m_bCudnnEnableTensorCores = p.m_bCudnnEnableTensorCores;
268 RawProto rpBase = base.ToProto(
"engine");
298 return new RawProto(strName,
"", rgChildren);
313 if ((strVal = rp.
FindValue(
"num_output")) !=
null)
317 if (rpWeightFiller !=
null)
321 if (rpBiasFiller !=
null)
324 if ((strVal = rp.
FindValue(
"debug_info")) !=
null)
327 if ((strVal = rp.
FindValue(
"expose_hidden")) !=
null)
333 if ((strVal = rp.
FindValue(
"expose_hidden_input")) !=
null)
336 if ((strVal = rp.
FindValue(
"expose_hidden_output")) !=
null)
339 if ((strVal = rp.
FindValue(
"dropout_ratio")) !=
null)
342 if ((strVal = rp.
FindValue(
"dropout_seed")) !=
null)
345 if ((strVal = rp.
FindValue(
"num_layers")) !=
null)
348 if ((strVal = rp.
FindValue(
"bidirectional")) !=
null)
351 if ((strVal = rp.
FindValue(
"cudnn_enable_tensor_cores")) !=
null)
354 if ((strVal= rp.
FindValue(
"batch_first")) !=
null)
357 if ((strVal = rp.
FindValue(
"auto_repeat_hidden_states_across_layers")) !=
null)
360 if ((strVal = rp.
FindValue(
"use_cudnn_rnn8_if_supported")) !=
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.
RawProtoCollection Children
Returns a collection of this nodes child nodes.
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 whether to use the NVIDIA cuDnn version or Caffe version of a given forward/backward operat...
Engine engine
Specifies the Engine in use.
EngineParameter()
Constructor for the parameter.
static EngineParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
Engine
Defines the type of engine to use.
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 used by the RecurrentLayer.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
static new RecurrentParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
bool use_cudnn_rnn8_if_supported
Specifies to use cuDnn RNN8 if supported (requires cuDnn 8.0 or higher), (default = false).
bool debug_info
Whether to enable displaying debug info in the unrolled recurrent net.
uint num_layers
The number of LSTM layers to implement.
uint num_output
The dimension of the output (and usually hidden state) representation – must be explicitly set to non...
FillerParameter weight_filler
The filler for the weights.
bool expose_hidden_output
Whether to add as additional outputs (tops) the final timestep hidden state blobs....
bool bidirectional
Specifies whether the network is bidirectional (true) or unidirectional (false - default).
bool batch_first
The input and outputs are shaped with the batch in the first dimension.
long dropout_seed
Specifies the seed used by cuDnn for random number generation.
bool useCudnn()
Queries whether or not to use NVIDIA's cuDnn.
RecurrentParameter()
Constructor for the parameter.
double dropout_ratio
Specifies the dropout ratio. (e.g. the probability that values will be dropped out and set to zero....
FillerParameter bias_filler
The filler for the bias.
override object Load(BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
bool cudnn_enable_tensor_cores
Specifies to enable the CUDA tensor cores when performing the rnn operations which is faster but not ...
bool auto_repeat_hidden_states_across_layers
Auto repeat the hidden and cell states so that a separate state is fed to each layer.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
string useCaffeReason()
Returns the reason that Caffe version was used instead of NVIDIA's cuDnn.
bool expose_hidden_input
Whether to add as additional inputs (bottoms) the initial hidden state blobss. The number of addition...
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-...