MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
ParameterParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using MyCaffe.basecode;
7
8namespace MyCaffe.param
9{
13 [Serializable]
14 [TypeConverter(typeof(ExpandableObjectConverter))]
16 {
17 BlobShape m_shape = new BlobShape();
18
21 {
22 }
23
27 [Description("Specifies the parameter shape.")]
29 {
30 get { return m_shape; }
31 set { m_shape = value; }
32 }
33
35 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
36 {
37 RawProto proto = RawProto.Parse(br.ReadString());
39
40 if (!bNewInstance)
41 Copy(p);
42
43 return p;
44 }
45
47 public override void Copy(LayerParameterBase src)
48 {
50 m_shape = p.m_shape.Clone();
51 }
52
54 public override LayerParameterBase Clone()
55 {
57 p.Copy(this);
58 return p;
59 }
60
66 public override RawProto ToProto(string strName)
67 {
68 RawProtoCollection rgChildren = new RawProtoCollection();
69
70 rgChildren.Add(m_shape.ToProto("shape"));
71
72 return new RawProto(strName, "", rgChildren);
73 }
74
81 {
83
84 RawProto rp1 = rp.FindChild("shape");
85 if (rp1 != null)
86 p.shape = BlobShape.FromProto(rp1);
87
88 return p;
89 }
90 }
91}
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
RawProto FindChild(string strName)
Searches for a given node.
Definition: RawProto.cs:231
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
Definition: RawProto.cs:306
Specifies the shape of a Blob.
Definition: BlobShape.cs:15
override RawProto ToProto(string strName)
Converts the BlobShape to a RawProto.
Definition: BlobShape.cs:153
BlobShape Clone()
Creates a copy of the BlobShape.
Definition: BlobShape.cs:102
static BlobShape FromProto(RawProto rp)
Parse a new BlobShape from a RawProto.
Definition: BlobShape.cs:167
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the parameters for the ParameterLayer
ParameterParameter()
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.
BlobShape shape
Specifies the parameter shape.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
static ParameterParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
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