MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
PReLUParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param
9{
19 [Serializable]
20 [TypeConverter(typeof(ExpandableObjectConverter))]
22 {
23 FillerParameter m_filler = new FillerParameter("constant", 0.25);
24 bool m_bChannelShared = false;
25
28 {
29 }
30
34 [Description("Specifies filler used for initial value of 'a_i'. Default is 'a_i' = 0.25 for all 'i'.")]
36 {
37 get { return m_filler; }
38 set { m_filler = value; }
39 }
40
44 [Description("Specifies whether or not slope parameters are shared across channels.")]
45 public bool channel_shared
46 {
47 get { return m_bChannelShared; }
48 set { m_bChannelShared = value; }
49 }
50
52 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
53 {
54 RawProto proto = RawProto.Parse(br.ReadString());
55 PReLUParameter p = FromProto(proto);
56
57 if (!bNewInstance)
58 Copy(p);
59
60 return p;
61 }
62
64 public override void Copy(LayerParameterBase src)
65 {
67
68 if (p.m_filler != null)
69 m_filler = p.m_filler.Clone();
70
71 m_bChannelShared = p.m_bChannelShared;
72 }
73
75 public override LayerParameterBase Clone()
76 {
78 p.Copy(this);
79 return p;
80 }
81
87 public override RawProto ToProto(string strName)
88 {
89 RawProtoCollection rgChildren = new RawProtoCollection();
90
91 if (m_filler != null)
92 rgChildren.Add(m_filler.ToProto("filler"));
93
94 if (channel_shared != false)
95 rgChildren.Add("channel_shared", channel_shared.ToString());
96
97 return new RawProto(strName, "", rgChildren);
98 }
99
106 {
107 string strVal;
109
110 RawProto rpFiller = rp.FindChild("filler");
111 if (rpFiller != null)
112 p.m_filler = FillerParameter.FromProto(rpFiller);
113
114 if ((strVal = rp.FindValue("channel_shared")) != null)
115 p.channel_shared = bool.Parse(strVal);
116
117 return p;
118 }
119 }
120}
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
RawProto FindChild(string strName)
Searches for a given node.
Definition: RawProto.cs:231
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
Specifies the filler parameters used to create each Filler.
static FillerParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
FillerParameter Clone()
Creates a new copy of this instance of the parameter.
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the PReLULayer.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
static PReLUParameter 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.
bool channel_shared
Specifies whether or not slope parameters are shared across channels.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
FillerParameter filler
Specifies initial value of . Default is for all i.
PReLUParameter()
Constructor for the parameter.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
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-...
Definition: Annotation.cs:12