2using System.Collections.Generic;
17 [TypeConverter(typeof(ExpandableObjectConverter))]
22 List<string> m_rgStage =
new List<string>();
35 public void Save(BinaryWriter bw)
37 bw.Write((
int)m_phase);
51 ns.m_phase = (
Phase)br.ReadInt32();
52 ns.m_nLevel = br.ReadInt32();
53 ns.m_rgStage =
Utility.Load<
string>(br);
61 [Description(
"Specifies the Phase of the NetState.")]
64 get {
return m_phase; }
65 set { m_phase = value; }
71 [Description(
"Specifies the level of the NetState.")]
74 get {
return m_nLevel; }
75 set { m_nLevel = value; }
81 [Description(
"Specifies the stages of the NetState.")]
84 get {
return m_rgStage; }
88 m_rgStage =
new List<string>();
103 if (m_phase ==
Phase.NONE)
108 foreach (
string strStage
in ns.m_rgStage)
110 if (!m_rgStage.Contains(strStage))
111 m_rgStage.Add(strStage);
123 ns.m_phase = m_phase;
124 ns.m_nLevel = m_nLevel;
125 ns.m_rgStage =
Utility.Clone<
string>(m_rgStage);
134 object ICloneable.
Clone()
166 rgChildren.
Add(
"phase",
phase.ToString());
167 rgChildren.
Add(
"level",
level.ToString());
168 rgChildren.
Add<
string>(
"stage",
stage);
170 return new RawProto(strName,
"", rgChildren);
183 if ((strVal = rp.
FindValue(
"phase")) !=
null)
200 throw new Exception(
"Unknown 'phase' value: " + strVal);
204 if ((strVal = rp.
FindValue(
"level")) !=
null)
205 p.
level =
int.Parse(strVal);
207 p.
stage = rp.FindArray<
string>(
"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 the NetState which includes the phase, level and stage for which a given Net is to run unde...
int CompareTo(object obj)
Compares this NetState to another one.
NetState()
The NetState constructor.
static NetState FromProto(RawProto rp)
Parses a RawProto representing a NetState into a NetState instance.
override RawProto ToProto(string strName)
Converts this NetState to a RawProto.
int level
Specifies the level of the NetState.
Phase phase
Specifies the Phase of the NetState.
NetState Clone()
Creates a new copy of this NetState instance.
static NetState Load(BinaryReader br)
Loads a new NetState instance from a binary reader.
void MergeFrom(NetState ns)
Merges another NetState with this instance.
void Save(BinaryWriter bw)
Saves the NetState to a binary writer.
List< string > stage
Specifies the stages of the NetState.
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-...