2using System.Collections.Generic;
17 [TypeConverter(typeof(ExpandableObjectConverter))]
25 string m_strName =
"";
52 double m_dfLrMult = 1.0;
57 double m_dfDecayMult = 1.0;
81 public ParamSpec(
double dfLrMult,
double dfDecayMult,
string strName =
null)
83 m_dfLrMult = dfLrMult;
84 m_dfDecayMult = dfDecayMult;
94 public void Save(BinaryWriter bw)
97 bw.Write((
int)m_shareMode);
99 bw.Write(m_dfDecayMult);
108 public object Load(BinaryReader br,
bool bNewInstance)
115 p.m_strName = br.ReadString();
117 p.m_dfLrMult = br.ReadDouble();
118 p.m_dfDecayMult = br.ReadDouble();
123#pragma warning disable 1591
128 get {
return m_strName; }
131#pragma warning restore 1591
136 [Description(
"Specifies the name of this parameter.")]
139 get {
return m_strName; }
140 set { m_strName = value; }
146 [Description(
"Specifies whether to require shared weights to have the same shape, or just the same count - defaults to STICT (same shape).")]
149 get {
return m_shareMode; }
150 set { m_shareMode = value; }
156 [Description(
"Specifies the multiplier used on the global learning rate for this parameter.")]
159 get {
return m_dfLrMult; }
160 set { m_dfLrMult = value; }
166 [Description(
"Specifies the multiplier used on the global weight decay for this parameter.")]
169 get {
return m_dfDecayMult; }
170 set { m_dfDecayMult = value; }
181 p.m_strName = m_strName;
182 p.m_shareMode = m_shareMode;
183 p.m_dfDecayMult = m_dfDecayMult;
184 p.m_dfLrMult = m_dfLrMult;
199 rgChildren.
Add(
"name",
"\"" +
name +
"\"");
204 rgChildren.
Add(
"lr_mult",
lr_mult.ToString());
209 return new RawProto(strName,
"", rgChildren);
222 if ((strVal = rp.
FindValue(
"name")) !=
null)
225 if ((strVal = rp.
FindValue(
"share_mode")) !=
null)
238 throw new Exception(
"Unknown 'share_mode' value: " + strVal);
242 if ((strVal = rp.
FindValue(
"lr_mult")) !=
null)
245 if ((strVal = rp.
FindValue(
"decay_mult")) !=
null)
The BaseParameter class is the base class for all other parameter classes.
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.
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
Specifies training parameters (multipliers on global learning constants, and the name of other settin...
double decay_mult
Specifies the multiplier used on the global weight decay for this parameter.
ParamSpec(double dfLrMult, double dfDecayMult, string strName=null)
The ParamSpec constructor.
override RawProto ToProto(string strName)
Converts the ParamSpec into a RawProto.
ParamSpec()
The ParamSpec constructor.
DimCheckMode
Defines the dimension check mode.
string name
Specifies the name of this parameter.
DimCheckMode share_mode
Specifies whether to require shared weights to have the same shape, or just the same count - defaults...
object Load(BinaryReader br, bool bNewInstance)
Loads a ParamSpec from a binary reader.
static ParamSpec FromProto(RawProto rp)
Parses a new ParamSpec from a RawProto.
void Save(BinaryWriter bw)
Saves the ParamSpec to a binary writer.
double lr_mult
Specifies the multiplier used on the global learning rate for this parameter.
object Clone()
Creates a new copy of the ParamSpec.
ParamSpec(string strName)
The ParamSpec constructor.
The IBinaryPersist interface provides generic save and load functionality.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
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-...