2using System.Collections.Generic;
27 [TypeConverter(typeof(ExpandableObjectConverter))]
31 double m_dfAlpha = 1.0;
32 double m_dfBeta = 1.0;
33 bool m_bDisableScalingOnGradient =
false;
49 [Description(
"The first axis to be lumped into a single Gram matrix computation -- may be negative to index from end (e.g., -1 for the last axis). For example, if axis == 2 and the input is (N x C x H x W), the output will be (N x C x C).")]
52 get {
return m_nAxis; }
53 set { m_nAxis = value; }
61 get {
return m_dfAlpha; }
62 set { m_dfAlpha = value; }
70 get {
return m_dfBeta; }
71 set { m_dfBeta = value; }
79 get {
return m_bDisableScalingOnGradient; }
80 set { m_bDisableScalingOnGradient = value; }
89 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
108 m_dfAlpha = p.m_dfAlpha;
109 m_dfBeta = p.m_dfBeta;
110 m_bDisableScalingOnGradient = p.m_bDisableScalingOnGradient;
133 rgChildren.
Add(
"axis",
axis.ToString());
134 rgChildren.
Add(
"alpha",
alpha.ToString());
135 rgChildren.
Add(
"beta",
beta.ToString());
138 return new RawProto(strName,
"", rgChildren);
151 if ((strVal = rp.
FindValue(
"axis")) !=
null)
152 p.
axis =
int.Parse(strVal);
154 if ((strVal = rp.
FindValue(
"alpha")) !=
null)
157 if ((strVal = rp.
FindValue(
"beta")) !=
null)
160 if ((strVal = rp.
FindValue(
"disable_scaling_on_gradient")) !=
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.
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.
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the GramLayer
static GramParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
double beta
Specifies the scaling factor applied after the gram operation.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
bool disable_scaling_on_gradient
Specifies whether or not to apply the un-scaling of the alpha and beta values during the during the b...
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
double alpha
Specifies the scaling factor applied before the gram operation.
GramParameter()
The constructor.
int axis
The first axis to be lumped into a single Gram matrix computation; all preceding axes are retained in...
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.param.nt namespace defines the parameters used by the Nerual Style Transfer layers.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...