MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
CategoricalTransformationParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
9{
18 [Serializable]
19 [TypeConverter(typeof(ExpandableObjectConverter))]
21 {
22 uint m_nNumInput = 0;
23 uint m_nStateSize = 0;
24 List<int> m_rgCardinalities = new List<int>();
25
28 {
29 }
30
34 [Description("The number of categorical inputs for the layer.")]
35 public uint num_input
36 {
37 get { return m_nNumInput; }
38 set { m_nNumInput = value; }
39 }
40
44 [Description("The state size that defines the output embedding dimension width.")]
45 public uint state_size
46 {
47 get { return m_nStateSize; }
48 set { m_nStateSize = value; }
49 }
50
54 [Description("The cardinalities specify the quantity of categories associated with each of the input variables.")]
55 public List<int> cardinalities
56 {
57 get { return m_rgCardinalities; }
58 set { m_rgCardinalities = value; }
59 }
60
62 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
63 {
64 RawProto proto = RawProto.Parse(br.ReadString());
66
67 if (!bNewInstance)
68 Copy(p);
69
70 return p;
71 }
72
74 public override void Copy(LayerParameterBase src)
75 {
77
78 m_nNumInput = p.m_nNumInput;
79 m_nStateSize = p.m_nStateSize;
80 m_rgCardinalities = new List<int>(p.m_rgCardinalities);
81 }
82
84 public override LayerParameterBase Clone()
85 {
87 p.Copy(this);
88 return p;
89 }
90
96 public override RawProto ToProto(string strName)
97 {
98 RawProtoCollection rgChildren = new RawProtoCollection();
99
100 rgChildren.Add("num_input", num_input.ToString());
101 rgChildren.Add("state_size", state_size.ToString());
102 rgChildren.Add<int>("cardinality", m_rgCardinalities);
103
104 return new RawProto(strName, "", rgChildren);
105 }
106
113 {
114 string strVal;
116
117 if ((strVal = rp.FindValue("num_input")) != null)
118 p.num_input = uint.Parse(strVal);
119
120 if ((strVal = rp.FindValue("state_size")) != null)
121 p.state_size = uint.Parse(strVal);
122
123 p.cardinalities = rp.FindArray<int>("cardinality");
124
125 return p;
126 }
127 }
128}
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.
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.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
static CategoricalTransformationParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
List< int > cardinalities
The cardinalities specify the quantity of categories associated with each of the input variables.
uint num_input
The number of categorical inputs for the layer.
uint state_size
The state size that defines the output embedding dimension width.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
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