MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
Normalization1Parameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param.beta
9{
16 [Serializable]
17 [TypeConverter(typeof(ExpandableObjectConverter))]
19 {
20 Norm m_norm = Norm.L2;
21
25 public enum Norm
26 {
30 L1 = 1,
34 L2 = 2
35 }
36
39 {
40 }
41
45 [Description("Specifies the normalization method to use.")]
46 public Norm norm
47 {
48 get { return m_norm; }
49 set { m_norm = value; }
50 }
51
58 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
59 {
60 RawProto proto = RawProto.Parse(br.ReadString());
62
63 if (!bNewInstance)
64 Copy(p);
65
66 return p;
67 }
68
73 public override void Copy(LayerParameterBase src)
74 {
76 m_norm = p.m_norm;
77 }
78
83 public override LayerParameterBase Clone()
84 {
86 p.Copy(this);
87 return p;
88 }
89
95 public override RawProto ToProto(string strName)
96 {
97 RawProtoCollection rgChildren = new RawProtoCollection();
98
99 rgChildren.Add("norm", m_norm.ToString());
100
101 return new RawProto(strName, "", rgChildren);
102 }
103
110 {
111 string strVal;
113
114 if ((strVal = rp.FindValue("norm")) != null)
115 {
116 if (strVal.ToLower() == Norm.L1.ToString().ToLower())
117 p.m_norm = Norm.L1;
118 else
119 p.m_norm = Norm.L2;
120 }
121
122 return p;
123 }
124 }
125}
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.
Definition: RawProto.cs:17
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
Definition: RawProto.cs:306
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
Definition: RawProto.cs:105
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the Normalization1Layer.
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.
Norm norm
Specifies the normalization method to use.
static Normalization1Parameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
Normalization1Parameter()
Constructor for the parameter.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
The MyCaffe.param.beta parameters are used by the MyCaffe.layer.beta layers.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12