MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
TVLossParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using MyCaffe.basecode;
7
8namespace MyCaffe.param.nt
9{
18 [Serializable]
19 [TypeConverter(typeof(ExpandableObjectConverter))]
21 {
22 float m_fBeta = 2;
23
28 {
29 }
30
34 [Description("The beta value.")]
35 public float beta
36 {
37 get { return m_fBeta; }
38 set { m_fBeta = value; }
39 }
40
47 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
48 {
49 RawProto proto = RawProto.Parse(br.ReadString());
50 TVLossParameter p = FromProto(proto);
51
52 if (!bNewInstance)
53 Copy(p);
54
55 return p;
56 }
57
62 public override void Copy(LayerParameterBase src)
63 {
65 m_fBeta = p.m_fBeta;
66 }
67
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("beta", beta.ToString());
89
90 return new RawProto(strName, "", rgChildren);
91 }
92
99 {
100 string strVal;
102
103 if ((strVal = rp.FindValue("beta")) != null)
104 p.beta = int.Parse(strVal);
105
106 return p;
107 }
108 }
109}
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 TVLossLayer
static TVLossParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
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.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
The MyCaffe.param.nt namespace defines the parameters used by the Nerual Style Transfer layers.
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12