MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
ReshapeTemporalParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param.tft
9{
21 [Serializable]
22 [TypeConverter(typeof(ExpandableObjectConverter))]
24 {
25 MODE m_mode = MODE.BEFORE;
26 bool m_bEnableClipOutput = false;
27 bool m_bEnableWtsOutput = false;
28 int m_nForcedRepeatCount = -1;
29
33 public enum MODE
34 {
38 BEFORE,
42 AFTER
43 }
44
47 {
48 }
49
53 [Description("Specifies the forced repeat steps bottom(1). A value of -1 specifies to use the temporal axis as the repeat count (default), otherwise the forced count is used to compy the entire blob that number of times.")]
55 {
56 get { return m_nForcedRepeatCount; }
57 set { m_nForcedRepeatCount = value; }
58 }
59
63 [Description("Specifies to output the clip for the data ouptut in the AFTER mode.")]
65 {
66 get { return m_bEnableClipOutput; }
67 set { m_bEnableClipOutput = value; }
68 }
69
73 [Description("Specifies to output the weights for the data ouptut in the AFTER mode.")]
75 {
76 get { return m_bEnableWtsOutput; }
77 set { m_bEnableWtsOutput = value; }
78 }
79
83 [Description("Specifies the mode of operation.")]
84 public MODE mode
85 {
86 get { return m_mode; }
87 set { m_mode = value; }
88 }
89
91 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
92 {
93 RawProto proto = RawProto.Parse(br.ReadString());
95
96 if (!bNewInstance)
97 Copy(p);
98
99 return p;
100 }
101
103 public override void Copy(LayerParameterBase src)
104 {
106
107 m_mode = p.mode;
108 m_bEnableClipOutput = p.enable_clip_output;
109 m_bEnableWtsOutput = p.enable_weight_output;
110 m_nForcedRepeatCount = p.forced_repeat_count;
111 }
112
114 public override LayerParameterBase Clone()
115 {
117 p.Copy(this);
118 return p;
119 }
120
126 public override RawProto ToProto(string strName)
127 {
128 RawProtoCollection rgChildren = new RawProtoCollection();
129
130 rgChildren.Add("mode", mode.ToString());
131 rgChildren.Add("enable_clip_output", enable_clip_output.ToString());
132 rgChildren.Add("enable_weight_output", enable_weight_output.ToString());
133 rgChildren.Add("forced_repeat_count", forced_repeat_count.ToString());
134
135 return new RawProto(strName, "", rgChildren);
136 }
137
144 {
145 string strVal;
147
148 if ((strVal = rp.FindValue("mode")) != null)
149 {
150 if (strVal == MODE.BEFORE.ToString())
151 p.mode = MODE.BEFORE;
152 else if (strVal == MODE.AFTER.ToString())
153 p.mode = MODE.AFTER;
154 else
155 throw new Exception("Invalid mode '" + strVal + "'.");
156 }
157
158 if ((strVal = rp.FindValue("enable_clip_output")) != null)
159 p.enable_clip_output = bool.Parse(strVal);
160
161 if ((strVal = rp.FindValue("enable_weight_output")) != null)
162 p.enable_weight_output = bool.Parse(strVal);
163
164 if ((strVal = rp.FindValue("forced_repeat_count")) != null)
165 p.forced_repeat_count = int.Parse(strVal);
166
167 return p;
168 }
169 }
170}
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 ReshapeTemporalLayer.
bool enable_weight_output
Specifies to output the weights for the data output in the AFTER mode.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
int forced_repeat_count
Specifies the forced repeat steps bottom(1). A value of -1 specifies to use the temporal axis as the ...
bool enable_clip_output
Specifies to output the clip for the data output in the AFTER mode.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
ReshapeTemporalParameter()
Constructor for the parameter.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
MODE mode
Specifies the mode of operation.
static ReshapeTemporalParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12