MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
LtcUnitParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param.lnn
9{
18 [Serializable]
19 [TypeConverter(typeof(ExpandableObjectConverter))]
21 {
22 int m_nInputSize = 0;
23 int m_nHiddenSize = 256;
24 int m_nOdeUnfolds = 6;
25 float m_fEpsilon = 1e-08f;
26 float m_fGleakInitMin = 0.001f;
27 float m_fGleakInitMax = 1.0f;
28 float m_fVleakInitMin = -0.2f;
29 float m_fVleakInitMax = 0.2f;
30 float m_fCmInitMin = 0.4f;
31 float m_fCmInitMax = 0.6f;
32 float m_fWInitMin = 0.001f;
33 float m_fWInitMax = 1.0f;
34 float m_fSigmaInitMin = 3.0f;
35 float m_fSigmaInitMax = 8.0f;
36 float m_fMuInitMin = 0.3f;
37 float m_fMuInitMax = 0.8f;
38 float m_fSensoryWInitMin = 0.001f;
39 float m_fSensoryWInitMax = 1.0f;
40 float m_fSensorySigmaInitMin = 3.0f;
41 float m_fSensorySigmaInitMax = 8.0f;
42 float m_fSensoryMuInitMin = 0.3f;
43 float m_fSensoryMuInitMax = 0.8f;
44
47 {
48 }
49
53 [Description("Specifies the input size.")]
54 public int input_size
55 {
56 get { return m_nInputSize; }
57 set { m_nInputSize = value; }
58 }
59
63 [Description("Specifies the number of hidden units (default = 256).")]
64 public int hidden_size
65 {
66 get { return m_nHiddenSize; }
67 set { m_nHiddenSize = value; }
68 }
69
73 [Description("Specifies the number of unfolds run by the ode (default = 6).")]
74 public int ode_unfolds
75 {
76 get { return m_nOdeUnfolds; }
77 set { m_nOdeUnfolds = value; }
78 }
79
83 [Description("Specifies the epsilon used to avoid divide by zero (default = 1e-08).")]
84 public float epsilon
85 {
86 get { return m_fEpsilon; }
87 set { m_fEpsilon = value; }
88 }
89
93 [Description("Specifies the initial gleak min value (default = 0.001f).")]
94 public float gleak_init_min
95 {
96 get { return m_fGleakInitMin; }
97 set { m_fGleakInitMin = value; }
98 }
99
103 [Description("Specifies the initial gleak max value (default = 1.0f).")]
104 public float gleak_init_max
105 {
106 get { return m_fGleakInitMax; }
107 set { m_fGleakInitMax = value; }
108 }
109
113 [Description("Specifies the initial vleak min value (default = -0.2f).")]
114 public float vleak_init_min
115 {
116 get { return m_fVleakInitMin; }
117 set { m_fVleakInitMin = value; }
118 }
119
123 [Description("Specifies the initial vleak max value (default = 0.2f).")]
124 public float vleak_init_max
125 {
126 get { return m_fVleakInitMax; }
127 set { m_fVleakInitMax = value; }
128 }
129
133 [Description("Specifies the initial cm min value (default = 0.4f).")]
134 public float cm_init_min
135 {
136 get { return m_fCmInitMin; }
137 set { m_fCmInitMin = value; }
138 }
139
143 [Description("Specifies the initial cm max value (default = 0.6f).")]
144 public float cm_init_max
145 {
146 get { return m_fCmInitMax; }
147 set { m_fCmInitMax = value; }
148 }
149
153 [Description("Specifies the initial w min value (default = 0.001f).")]
154 public float w_init_min
155 {
156 get { return m_fWInitMin; }
157 set { m_fWInitMin = value; }
158 }
159
163 [Description("Specifies the initial w max value (default = 1.0f).")]
164 public float w_init_max
165 {
166 get { return m_fWInitMax; }
167 set { m_fWInitMax = value; }
168 }
169
173 [Description("Specifies the initial sigma min value (default = 3.0f).")]
174 public float sigma_init_min
175 {
176 get { return m_fSigmaInitMin; }
177 set { m_fSigmaInitMin = value; }
178 }
179
183 [Description("Specifies the initial sigma max value (default = 8.0f).")]
184 public float sigma_init_max
185 {
186 get { return m_fSigmaInitMax; }
187 set { m_fSigmaInitMax = value; }
188 }
189
193 [Description("Specifies the initial mu min value (default = 0.3f).")]
194 public float mu_init_min
195 {
196 get { return m_fMuInitMin; }
197 set { m_fMuInitMin = value; }
198 }
199
203 [Description("Specifies the initial mu max value (default = 0.8f).")]
204 public float mu_init_max
205 {
206 get { return m_fMuInitMax; }
207 set { m_fMuInitMax = value; }
208 }
209
213 [Description("Specifies the initial sensory_w min value (default = 0.001f).")]
215 {
216 get { return m_fSensoryWInitMin; }
217 set { m_fSensoryWInitMin = value; }
218 }
219
223 [Description("Specifies the initial sensory_w max value (default = 1.0f).")]
225 {
226 get { return m_fSensoryWInitMax; }
227 set { m_fSensoryWInitMax = value; }
228 }
229
233 [Description("Specifies the initial sensory_sigma min value (default = 3.0f).")]
235 {
236 get { return m_fSensorySigmaInitMin; }
237 set { m_fSensorySigmaInitMin = value; }
238 }
239
243 [Description("Specifies the initial sensory_sigma max value (default = 8.0f).")]
245 {
246 get { return m_fSensorySigmaInitMax; }
247 set { m_fSensorySigmaInitMax = value; }
248 }
249
253 [Description("Specifies the initial sensory_mu min value (default = 0.3f).")]
255 {
256 get { return m_fSensoryMuInitMin; }
257 set { m_fSensoryMuInitMin = value; }
258 }
259
263 [Description("Specifies the initial sensory_mu max value (default = 0.8f).")]
265 {
266 get { return m_fSensoryMuInitMax; }
267 set { m_fSensoryMuInitMax = value; }
268 }
269
271 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
272 {
273 RawProto proto = RawProto.Parse(br.ReadString());
274 LtcUnitParameter p = FromProto(proto);
275
276 if (!bNewInstance)
277 Copy(p);
278
279 return p;
280 }
281
283 public override void Copy(LayerParameterBase src)
284 {
286
287 m_nInputSize = p.input_size;
288 m_nHiddenSize = p.hidden_size;
289 m_nOdeUnfolds = p.ode_unfolds;
290 m_fEpsilon = p.epsilon;
291
292 m_fGleakInitMin = p.gleak_init_min;
293 m_fGleakInitMax = p.gleak_init_max;
294 m_fVleakInitMin = p.vleak_init_min;
295 m_fVleakInitMax = p.vleak_init_max;
296 m_fCmInitMin = p.cm_init_min;
297 m_fCmInitMax = p.cm_init_max;
298 m_fWInitMin = p.w_init_min;
299 m_fWInitMax = p.w_init_max;
300 m_fSigmaInitMin = p.sigma_init_min;
301 m_fSigmaInitMax = p.sigma_init_max;
302 m_fMuInitMin = p.mu_init_min;
303 m_fMuInitMax = p.mu_init_max;
304 m_fSensoryWInitMin = p.sensory_w_init_min;
305 m_fSensoryWInitMax = p.sensory_w_init_max;
306 m_fSensorySigmaInitMin = p.sensory_sigma_init_min;
307 m_fSensorySigmaInitMax = p.sensory_sigma_init_max;
308 m_fSensoryMuInitMin = p.sensory_mu_init_min;
309 m_fSensoryMuInitMax = p.sensory_mu_init_max;
310 }
311
313 public override LayerParameterBase Clone()
314 {
316 p.Copy(this);
317 return p;
318 }
319
325 public override RawProto ToProto(string strName)
326 {
327 RawProtoCollection rgChildren = new RawProtoCollection();
328
329 rgChildren.Add("input_size", input_size.ToString());
330 rgChildren.Add("hidden_size", hidden_size.ToString());
331 rgChildren.Add("ode_unfolds", ode_unfolds.ToString());
332 rgChildren.Add("epsilon", epsilon.ToString());
333
334 rgChildren.Add("gleak_init_min", gleak_init_min.ToString());
335 rgChildren.Add("gleak_init_max", gleak_init_max.ToString());
336 rgChildren.Add("vleak_init_min", vleak_init_min.ToString());
337 rgChildren.Add("vleak_init_max", vleak_init_max.ToString());
338 rgChildren.Add("cm_init_min", cm_init_min.ToString());
339 rgChildren.Add("cm_init_max", cm_init_max.ToString());
340 rgChildren.Add("w_init_min", w_init_min.ToString());
341 rgChildren.Add("w_init_max", w_init_max.ToString());
342 rgChildren.Add("sigma_init_min", sigma_init_min.ToString());
343 rgChildren.Add("sigma_init_max", sigma_init_max.ToString());
344 rgChildren.Add("mu_init_min", mu_init_min.ToString());
345 rgChildren.Add("mu_init_max", mu_init_max.ToString());
346 rgChildren.Add("sensory_w_init_min", sensory_w_init_min.ToString());
347 rgChildren.Add("sensory_w_init_max", sensory_w_init_max.ToString());
348 rgChildren.Add("sensory_sigma_init_min", sensory_sigma_init_min.ToString());
349 rgChildren.Add("sensory_sigma_init_max", sensory_sigma_init_max.ToString());
350 rgChildren.Add("sensory_mu_init_min", sensory_mu_init_min.ToString());
351 rgChildren.Add("sensory_mu_init_max", sensory_mu_init_max.ToString());
352
353 return new RawProto(strName, "", rgChildren);
354 }
355
362 {
363 string strVal;
365
366 if ((strVal = rp.FindValue("input_size")) != null)
367 p.input_size = int.Parse(strVal);
368
369 if ((strVal = rp.FindValue("hidden_size")) != null)
370 p.hidden_size = int.Parse(strVal);
371
372 if ((strVal = rp.FindValue("ode_unfolds")) != null)
373 p.ode_unfolds = int.Parse(strVal);
374
375 if ((strVal = rp.FindValue("epsilon")) != null)
376 p.epsilon = ParseFloat(strVal);
377
378 if ((strVal = rp.FindValue("gleak_init_min")) != null)
379 p.gleak_init_min = ParseFloat(strVal);
380
381 if ((strVal = rp.FindValue("gleak_init_max")) != null)
382 p.gleak_init_max = ParseFloat(strVal);
383
384 if ((strVal = rp.FindValue("vleak_init_min")) != null)
385 p.vleak_init_min = ParseFloat(strVal);
386
387 if ((strVal = rp.FindValue("vleak_init_max")) != null)
388 p.vleak_init_max = ParseFloat(strVal);
389
390 if ((strVal = rp.FindValue("cm_init_min")) != null)
391 p.cm_init_min = ParseFloat(strVal);
392
393 if ((strVal = rp.FindValue("cm_init_max")) != null)
394 p.cm_init_max = ParseFloat(strVal);
395
396 if ((strVal = rp.FindValue("w_init_min")) != null)
397 p.w_init_min = ParseFloat(strVal);
398
399 if ((strVal = rp.FindValue("w_init_max")) != null)
400 p.w_init_max = ParseFloat(strVal);
401
402 if ((strVal = rp.FindValue("sigma_init_min")) != null)
403 p.sigma_init_min = ParseFloat(strVal);
404
405 if ((strVal = rp.FindValue("sigma_init_max")) != null)
406 p.sigma_init_max = ParseFloat(strVal);
407
408 if ((strVal = rp.FindValue("mu_init_min")) != null)
409 p.mu_init_min = ParseFloat(strVal);
410
411 if ((strVal = rp.FindValue("mu_init_max")) != null)
412 p.mu_init_max = ParseFloat(strVal);
413
414 if ((strVal = rp.FindValue("sensory_w_init_min")) != null)
415 p.sensory_w_init_min = ParseFloat(strVal);
416
417 if ((strVal = rp.FindValue("sensory_w_init_max")) != null)
418 p.sensory_w_init_max = ParseFloat(strVal);
419
420 if ((strVal = rp.FindValue("sensory_sigma_init_min")) != null)
422
423 if ((strVal = rp.FindValue("sensory_sigma_init_max")) != null)
425
426 if ((strVal = rp.FindValue("sensory_mu_init_min")) != null)
428
429 if ((strVal = rp.FindValue("sensory_mu_init_max")) != null)
431
432 return p;
433 }
434 }
435}
static float ParseFloat(string strVal)
Parse float values using the US culture if the decimal separator = '.', then using the native culture...
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.
Definition: RawProto.cs:17
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
Definition: RawProto.cs:306
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
Definition: RawProto.cs:105
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the LtcUnitLayer used by the CfCLayer.
float sensory_sigma_init_min
Specifies the initial sensory_sigma min value (default = 3.0f).
int hidden_size
Specifies the number of hidden units (default = 256).
override void Copy(LayerParameterBase src)
Copy on parameter to another.
LtcUnitParameter()
Constructor for the parameter.
float mu_init_max
Specifies the initial mu max value (default = 0.8f).
float w_init_max
Specifies the initial w max value (default = 1.0f).
float cm_init_min
Specifies the initial cm min value (default = 0.4f).
float sensory_mu_init_min
Specifies the initial sensory_mu min value (default = 0.3f).
float sigma_init_max
Specifies the initial sigma max value (default = 8.0f).
float sensory_w_init_min
Specifies the initial sensory_w min value (default = 0.001f).
float vleak_init_max
Specifies the initial vleak max value (default = 0.2f).
float sensory_sigma_init_max
Specifies the initial sensory_sigma max value (default = 8.0f).
float sigma_init_min
Specifies the initial sigma min value (default = 3.0f).
float sensory_mu_init_max
Specifies the initial sensory_mu max value (default = 0.8f).
float w_init_min
Specifies the initial w min value (default = 0.001f).
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
float gleak_init_min
Specifies the initial gleak min value (default = 0.001f).
float epsilon
Specifies the epsilon used to avoid divide by zero (default = 1e-08).
float cm_init_max
Specifies the initial cm max value (default = 0.6f).
float vleak_init_min
Specifies the initial vleak min value (default = -0.2f).
static LtcUnitParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
float mu_init_min
Specifies the initial mu min value (default = 0.3f).
int ode_unfolds
Specifies the number of unfolds run by the ode (default = 6).
float sensory_w_init_max
Specifies the initial sensory_w max value (default = 1.0f).
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
int input_size
Specifies the input size.
float gleak_init_max
Specifies the initial gleak max value (default = 1.0f).
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12