MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
UnPoolingParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param.beta
9{
20 [Serializable]
21 [TypeConverter(typeof(ExpandableObjectConverter))]
23 {
24 List<uint> m_rgUnpool = new List<uint>();
25 uint? m_nUnPoolH = null;
26 uint? m_nUnPoolW = null;
27
30 {
31 }
32
37 public new string useCaffeReason()
38 {
39 return "Not supported by cuDNN.";
40 }
41
46 public new bool useCudnn()
47 {
48 return false;
49 }
50
55 [Description("Specifies unpool size override given as a single value for equal dimensions in all spatial dimensions, or once per spatial dimension.")]
56 public List<uint> unpool_size
57 {
58 get { return m_rgUnpool; }
59 set { m_rgUnpool = value; }
60 }
61
69 [Description("Specifies unpooling height override (2D only). 'unpool_h' and 'unpool_w' are used -or- 'unpool_size' is used, but not both.")]
70 public uint? unpool_h
71 {
72 get { return m_nUnPoolH; }
73 set { m_nUnPoolH = value; }
74 }
75
83 [Description("Specifies unpooling width override (2D only). 'unpool_h' and 'unpool_w' are used -or- 'unpool_size' is used, but not both.")]
84 public uint? unpool_w
85 {
86 get { return m_nUnPoolW; }
87 set { m_nUnPoolW = value; }
88 }
89
90
97 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
98 {
99 RawProto proto = RawProto.Parse(br.ReadString());
101
102 if (p == null)
103 throw new Exception("Expected UnPoolingParameter type!");
104
105 if (!bNewInstance)
106 Copy(p);
107
108 return p;
109 }
110
115 public override void Copy(LayerParameterBase src)
116 {
117 base.Copy(src);
118
119 if (src is UnPoolingParameter)
120 {
122
123 m_rgUnpool = Utility.Clone<uint>(p.m_rgUnpool);
124 m_nUnPoolH = p.m_nUnPoolH;
125 m_nUnPoolW = p.m_nUnPoolW;
126 }
127 }
128
133 public override LayerParameterBase Clone()
134 {
136 p.Copy(this);
137 return p;
138 }
139
145 public override RawProto ToProto(string strName)
146 {
147 dilation.Clear();
148 RawProto rpBase = base.ToProto("pooling");
149 RawProtoCollection rgChildren = new RawProtoCollection();
150
151 rgChildren.Add(rpBase.Children);
152 rgChildren.Add<uint>("unpool_size", m_rgUnpool);
153 rgChildren.Add("unpool_h", m_nUnPoolH);
154 rgChildren.Add("unpool_w", m_nUnPoolW);
155
156 return new RawProto(strName, "", rgChildren);
157 }
158
165 {
167
169
170 p.m_rgUnpool = rp.FindArray<uint>("unpool_size");
171 p.m_nUnPoolH = (uint?)rp.FindValue("unpool_h", typeof(uint));
172 p.m_nUnPoolW = (uint?)rp.FindValue("unpool_w", typeof(uint));
173
174 return p;
175 }
176 }
177}
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
RawProtoCollection Children
Returns a collection of this nodes child nodes.
Definition: RawProto.cs:96
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 Utility class provides general utility funtions.
Definition: Utility.cs:35
List< uint > dilation
Factor used to dilate the kernel, (implicitly) zero-filling the resulting holes. (Kernel dilation is ...
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the PoolingLayer.
PoolingParameter()
Constructor for the parameter.
static new PoolingParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
Specifies the parameters for the UnPoolingLayer.
UnPoolingParameter()
Constructor for the parameter.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
new bool useCudnn()
Queries whether or not to use NVIDIA's cuDnn.
List< uint > unpool_size
UnPool size is given as a single value for equal dimensions in all spatial dimensions,...
static new UnPoolingParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
new string useCaffeReason()
Returns the reason that Caffe version was used instead of NVIDIA's cuDnn.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
uint? unpool_h
The unpooling height override (2D only)
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
uint? unpool_w
The unpooling width override (2D only)
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