2using System.Collections.Generic;
18 [TypeConverter(typeof(ExpandableObjectConverter))]
22 int? m_nMinLevel =
null;
23 int? m_nMaxLevel =
null;
24 List<string> m_rgStage =
new List<string>();
25 List<string> m_rgNotStage =
new List<string>();
47 public void Save(BinaryWriter bw)
49 bw.Write((
int)m_phase);
51 bw.Write(m_nMinLevel.HasValue);
52 if (m_nMinLevel.HasValue)
53 bw.Write(m_nMinLevel.Value);
55 bw.Write(m_nMaxLevel.HasValue);
56 if (m_nMaxLevel.HasValue)
57 bw.Write(m_nMaxLevel.Value);
69 public object Load(BinaryReader br,
bool bNewInstance)
76 p.m_phase = (
Phase)br.ReadInt32();
79 p.m_nMinLevel = br.ReadInt32();
82 p.m_nMaxLevel = br.ReadInt32();
84 p.m_rgStage =
Utility.Load<
string>(br);
85 p.m_rgNotStage =
Utility.Load<
string>(br);
97 [Description(
"Specifies the phase required to meet this rule.")]
100 get {
return m_phase; }
101 set { m_phase = value; }
108 [Description(
"Specifies the minimum level in which the layer should be used.")]
111 get {
return m_nMinLevel; }
112 set { m_nMinLevel = value; }
119 [Description(
"Specifies the maximum level in which the layer should be used.")]
122 get {
return m_nMaxLevel; }
123 set { m_nMaxLevel = value; }
132 [Description(
"Specifies the stage required to meet this rule.")]
133 [Editor(
@"System.Windows.Forms.Design.StringCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(
System.Drawing.Design.UITypeEditor))]
134 [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
138 get {
return m_rgStage; }
139 set { m_rgStage = value; }
148 [Description(
"Specifies the 'not_stage' that cannot be specified to meet this rule.")]
149 [Editor(
@"System.Windows.Forms.Design.StringCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(
System.Drawing.Design.UITypeEditor))]
150 [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
154 get {
return m_rgNotStage; }
155 set { m_rgNotStage = value; }
166 ns.m_nMaxLevel = m_nMaxLevel;
167 ns.m_nMinLevel = m_nMinLevel;
168 ns.m_phase = m_phase;
169 ns.m_rgNotStage =
Utility.Clone<
string>(m_rgNotStage);
170 ns.m_rgStage =
Utility.Clone<
string>(m_rgStage);
184 rgChildren.
Add(
"phase",
phase.ToString());
193 rgChildren.
Add<
string>(
"stage",
stage);
198 return new RawProto(strName,
"", rgChildren);
211 if ((strVal = rp.
FindValue(
"phase")) !=
null)
236 throw new Exception(
"Unknown 'phase' value: " + strVal);
242 p.
stage = rp.FindArray<
string>(
"stage");
243 p.
not_stage = rp.FindArray<
string>(
"not_stage");
The BaseParameter class is the base class for all other parameter classes.
virtual bool Compare(BaseParameter p)
Compare this parameter to another parameter.
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.
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
The Utility class provides general utility funtions.
static void Save(BinaryWriter bw, List< double > rg)
Save a list of double to a binary writer.
Specifies a NetStateRule used to determine whether a Net falls within a given include or exclude patt...
override RawProto ToProto(string strName)
Converts a NetStateRule into a RawProto.
NetStateRule(Phase p)
Specifies the NetStateRule constructor.
NetStateRule()
Specifies the NetStateRule constructor.
List< string > stage
Customizable sets of stages to include. The net must have ALL of the specified stages and NONE of the...
static NetStateRule FromProto(RawProto rp)
Parses a RawProto representing a NetStateRule and creates a new instance of a NetStateRule from it.
object Load(BinaryReader br, bool bNewInstance)
Loads a NetStateRule from a binary reader.
int? min_level
Set the minimum levels in which the layer should be used. Leave undefined to meet the rule regardless...
Phase phase
Set phase to require the NetState to have a particular phase (TRAIN or TEST) to meet this rule.
object Clone()
Creates a new copy of a NetStateRule instance.
int? max_level
Set the maximum levels in which the layer should be used. Leave undefined to meet the rule regardless...
List< string > not_stage
Customizable sets of stages to exclude. The net must have ALL of the specified stages and NONE of the...
void Save(BinaryWriter bw)
Saves the NetStateRule to a given binary writer.
int CompareTo(object obj)
Compares this NetStateRule to another one.
The CsvConverter is used to display string lists on a single line in a property grid.
The IBinaryPersist interface provides generic save and load functionality.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Phase
Defines the Phase under which to run a Net.
The MyCaffe.common namespace contains common MyCaffe classes.
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-...