MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
NumericTransformationParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param.tft
9{
18 [Serializable]
19 [TypeConverter(typeof(ExpandableObjectConverter))]
21 {
22 uint m_nNumInput = 0;
23 uint m_nStateSize = 0;
24
27 {
28 }
29
33 [Description("The number of inputs for the layer.")]
34 public uint num_input
35 {
36 get { return m_nNumInput; }
37 set { m_nNumInput = value; }
38 }
39
43 [Description("The state size that defines the output vector width.")]
44 public uint state_size
45 {
46 get { return m_nStateSize; }
47 set { m_nStateSize = value; }
48 }
49
51 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
52 {
53 RawProto proto = RawProto.Parse(br.ReadString());
55
56 if (!bNewInstance)
57 Copy(p);
58
59 return p;
60 }
61
63 public override void Copy(LayerParameterBase src)
64 {
66
67 m_nNumInput = p.m_nNumInput;
68 m_nStateSize = p.m_nStateSize;
69 }
70
72 public override LayerParameterBase Clone()
73 {
75 p.Copy(this);
76 return p;
77 }
78
84 public override RawProto ToProto(string strName)
85 {
86 RawProtoCollection rgChildren = new RawProtoCollection();
87
88 rgChildren.Add("num_input", num_input.ToString());
89 rgChildren.Add("state_size", state_size.ToString());
90
91 return new RawProto(strName, "", rgChildren);
92 }
93
100 {
101 string strVal;
103
104 if ((strVal = rp.FindValue("num_input")) != null)
105 p.num_input = uint.Parse(strVal);
106
107 if ((strVal = rp.FindValue("state_size")) != null)
108 p.state_size = uint.Parse(strVal);
109
110 return p;
111 }
112 }
113}
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 NumericInputTransformationLayer.
uint state_size
The state size that defines the output vector width.
static NumericTransformationParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
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