MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
InfogainLossParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param
9{
16 [Serializable]
17 [TypeConverter(typeof(ExpandableObjectConverter))]
19 {
20 string m_strSource;
21 int m_nAxis = 1;
22
25 {
26 }
27
31 [Description("Specifies the infogain matrix source.")]
32 public string source
33 {
34 get { return m_strSource; }
35 set { m_strSource = value; }
36 }
37
41 [Description("Specifies the axis of the probability, default = 1")]
42 public int axis
43 {
44 get { return m_nAxis; }
45 set { m_nAxis = value; }
46 }
47
49 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
50 {
51 RawProto proto = RawProto.Parse(br.ReadString());
53
54 if (!bNewInstance)
55 Copy(p);
56
57 return p;
58 }
59
61 public override void Copy(LayerParameterBase src)
62 {
64 m_strSource = p.m_strSource;
65 m_nAxis = p.m_nAxis;
66 }
67
69 public override LayerParameterBase Clone()
70 {
72 p.Copy(this);
73 return p;
74 }
75
81 public override RawProto ToProto(string strName)
82 {
83 RawProtoCollection rgChildren = new RawProtoCollection();
84
85 rgChildren.Add("source", "\"" + source + "\"");
86
87 if (axis != 1)
88 rgChildren.Add("axis", axis.ToString());
89
90 return new RawProto(strName, "", rgChildren);
91 }
92
99 {
100 string strVal;
102
103 if ((strVal = rp.FindValue("source")) != null)
104 p.source = strVal;
105
106 if ((strVal = rp.FindValue("axis")) != null)
107 p.axis = int.Parse(strVal);
108
109 return p;
110 }
111 }
112}
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
Specifies the parameters for the InfogainLossLayer.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
string source
Specifies the infogain matrix source.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
int axis
[optional, default = 1] Specifies the axis of the probability.
static InfogainLossParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
InfogainLossParameter()
Constructor for the parameter.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
The LayerParameterBase is the base class for all other layer specific parameters.
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