MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
OptionalParameter.cs
1using MyCaffe.basecode;
2using System;
3using System.Collections.Generic;
5using System.Linq;
6using System.Text;
7using System.Threading.Tasks;
8
9namespace MyCaffe.param
10{
14 [Serializable]
15 [TypeConverter(typeof(ExpandableObjectConverter))]
16 public class OptionalParameter
17 {
18 bool m_bActive = false;
19
24 public OptionalParameter(bool bActive = false)
25 {
26 m_bActive = bActive;
27 }
28
32 [Description("Specifies whether or not this parameter is enabled (and used). This parameter is not used when this setting is False.")]
33 public bool Active
34 {
35 get { return m_bActive; }
36 set { m_bActive = value; }
37 }
38
43 public virtual void Copy(OptionalParameter src)
44 {
45 m_bActive = src.m_bActive;
46 }
47
53 public virtual RawProto ToProto(string strName)
54 {
55 RawProtoCollection rgChildren = new RawProtoCollection();
56
57 rgChildren.Add("active", m_bActive.ToString());
58
59 return new RawProto(strName, "", rgChildren);
60 }
61
68 {
69 string strVal;
71
72 if ((strVal = rp.FindValue("active")) != null)
73 p.Active = bool.Parse(strVal);
74
75 return p;
76 }
77 }
78}
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
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
Definition: RawProto.cs:105
The OptionalParameter is the base class for parameters that are optional such as the MaskParameter,...
virtual RawProto ToProto(string strName)
Convert this object to a raw proto.
virtual void Copy(OptionalParameter src)
Copy the source object.
static OptionalParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
OptionalParameter(bool bActive=false)
The constructor.
bool Active
When active, the parameter is used, otherwise it is ignored.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
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-...
Definition: Annotation.cs:12