2using System.Collections.Generic;
18 [TypeConverter(typeof(ExpandableObjectConverter))]
21 uint m_nLocalSize = 5;
22 double m_dfAlpha = 1e-4;
23 double m_dfBeta = 0.75;
55 return "The engine setting is set on CAFFE.";
58 return "Currently using the normalization region 'WITHIN_CHANNEL' returns inconsistent errors from Caffe.";
79 [Description(
"Specifies the local size of the normalization window width.")]
82 get {
return m_nLocalSize; }
83 set { m_nLocalSize = value; }
89 [Description(
"Specifies the alpha value used for variance scaling in the normalization formula. NOTE: cuDNN uses a default of alpha = 1e-4, whereas CAFFE uses a default of alpha = 1.0.")]
92 get {
return m_dfAlpha; }
93 set { m_dfAlpha = value; }
99 [Description(
"Specifies the beta value used as the power parameter in the normalization formula. NOTE: both cuDNN and CAFFE use a default of beta = 0.75.")]
102 get {
return m_dfBeta; }
103 set { m_dfBeta = value; }
109 [Description(
"Specifies the region over which to normalize.")]
112 get {
return m_normRegion; }
113 set { m_normRegion = value; }
119 [Description(
"Specifies the k value used by the normalization parameter. NOTE: cuDNN uses a default of k = 2.0, whereas CAFFE uses a default of k = 2.0.")]
122 get {
return m_dfK; }
123 set { m_dfK = value; }
127 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
146 m_nLocalSize = p.m_nLocalSize;
147 m_dfAlpha = p.m_dfAlpha;
148 m_dfBeta = p.m_dfBeta;
149 m_normRegion = p.m_normRegion;
165 RawProto rpBase = base.ToProto(
"engine");
170 rgChildren.
Add(
"alpha",
alpha.ToString());
171 rgChildren.
Add(
"beta",
beta.ToString());
173 rgChildren.
Add(
"k",
k.ToString());
175 return new RawProto(strName,
"", rgChildren);
190 if ((strVal = rp.
FindValue(
"local_size")) !=
null)
193 if ((strVal = rp.
FindValue(
"alpha")) !=
null)
196 if ((strVal = rp.
FindValue(
"beta")) !=
null)
199 if ((strVal = rp.
FindValue(
"norm_region")) !=
null)
203 case "ACROSS_CHANNELS":
207 case "WITHIN_CHANNEL":
212 throw new Exception(
"Unknown 'norm_region' value: " + strVal);
216 if ((strVal = rp.
FindValue(
"k")) !=
null)
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.
RawProtoCollection Children
Returns a collection of this nodes child nodes.
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
Specifies whether to use the NVIDIA cuDnn version or Caffe version of a given forward/backward operat...
Engine engine
Specifies the Engine in use.
EngineParameter()
Constructor for the parameter.
static EngineParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
Engine
Defines the type of engine to use.
Specifies the parameter for the LRNLayer.
bool useCudnn()
Queries whether or not to use NVIDIA's cuDnn.
LRNParameter()
Constructor for the parameter.
NormRegion
Defines the normalization region.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
double beta
Specifies the beta value used as the power parameter in the normalization formula....
NormRegion norm_region
Specifies the region over which to normalize.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
static new LRNParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
uint local_size
Specifies the local size of the normalization window width.
string useCaffeReason()
Returns the reason that Caffe version was used instead of NVIDIA's cuDnn.
double alpha
Specifies the alpha value used for variance scaling in the normalization formula. NOTE: cuDNN uses a ...
double k
Specifies the k value used by the normalization parameter. NOTE: cuDNN uses a default of k = 2....
override void Copy(LayerParameterBase src)
Copy on parameter to another.
The LayerParameterBase is the base class for all other layer specific parameters.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
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-...