MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
ThresholdParameter.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 double m_dfThreshold = 0;
21
24 {
25 }
26
30 [Description("Specifies the threshold value which must be strictly positive values.")]
31 public double threshold
32 {
33 get { return m_dfThreshold; }
34 set { m_dfThreshold = value; }
35 }
36
38 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
39 {
40 RawProto proto = RawProto.Parse(br.ReadString());
42
43 if (!bNewInstance)
44 Copy(p);
45
46 return p;
47 }
48
50 public override void Copy(LayerParameterBase src)
51 {
53 m_dfThreshold = p.m_dfThreshold;
54 }
55
57 public override LayerParameterBase Clone()
58 {
60 p.Copy(this);
61 return p;
62 }
63
69 public override RawProto ToProto(string strName)
70 {
71 RawProtoCollection rgChildren = new RawProtoCollection();
72
73 rgChildren.Add("threshold", threshold.ToString());
74
75 return new RawProto(strName, "", rgChildren);
76 }
77
84 {
85 string strVal;
87
88 if ((strVal = rp.FindValue("threshold")) != null)
89 p.threshold = ParseDouble(strVal);
90
91 return p;
92 }
93 }
94}
static double ParseDouble(string strVal)
Parse double values using the US culture if the decimal separator = '.', then using the native cultur...
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.
Stores the parameters used by the ThresholdLayer
static ThresholdParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
double threshold
Specifies the threshold value which must be strictly positive values.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
ThresholdParameter()
Constructor for the parameter.
override RawProto ToProto(string strName)
Convert the parameter into 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.
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