MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
NLLLossParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param.gpt
9{
17 [Serializable]
18 [TypeConverter(typeof(ExpandableObjectConverter))]
20 {
21 int m_nAxis = 1;
22
25 {
26 }
27
31 [Description("Specifies the axis of the probability, default = 1")]
32 public int axis
33 {
34 get { return m_nAxis; }
35 set { m_nAxis = value; }
36 }
37
39 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
40 {
41 RawProto proto = RawProto.Parse(br.ReadString());
42 NLLLossParameter p = FromProto(proto);
43
44 if (!bNewInstance)
45 Copy(p);
46
47 return p;
48 }
49
51 public override void Copy(LayerParameterBase src)
52 {
54 m_nAxis = p.m_nAxis;
55 }
56
58 public override LayerParameterBase Clone()
59 {
61 p.Copy(this);
62 return p;
63 }
64
70 public override RawProto ToProto(string strName)
71 {
72 RawProtoCollection rgChildren = new RawProtoCollection();
73
74 rgChildren.Add("axis", axis.ToString());
75
76 return new RawProto(strName, "", rgChildren);
77 }
78
85 {
86 string strVal;
88
89 if ((strVal = rp.FindValue("axis")) != null)
90 p.axis = int.Parse(strVal);
91
92 return p;
93 }
94 }
95}
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 NLLLossLayer.
int axis
[optional, default = 1] Specifies the axis of the probability.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
static NLLLossParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
NLLLossParameter()
Constructor for 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