MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
TileParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param
9{
13 [Serializable]
14 [TypeConverter(typeof(ExpandableObjectConverter))]
16 {
17 int m_nAxis = 1;
18 int m_nTiles = 0;
19
22 {
23 }
24
28 [Description("Specifies the axis for which to tile.")]
29 public int axis
30 {
31 get { return m_nAxis; }
32 set { m_nAxis = value; }
33 }
34
38 [Description("Specifies the number of copies (tiles) of the blob to output.")]
39 public int tiles
40 {
41 get { return m_nTiles; }
42 set { m_nTiles = value; }
43 }
44
46 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
47 {
48 RawProto proto = RawProto.Parse(br.ReadString());
49 TileParameter p = FromProto(proto);
50
51 if (!bNewInstance)
52 Copy(p);
53
54 return p;
55 }
56
58 public override void Copy(LayerParameterBase src)
59 {
61 m_nAxis = p.m_nAxis;
62 m_nTiles = p.m_nTiles;
63 }
64
66 public override LayerParameterBase Clone()
67 {
69 p.Copy(this);
70 return p;
71 }
72
78 public override RawProto ToProto(string strName)
79 {
80 RawProtoCollection rgChildren = new RawProtoCollection();
81
82 rgChildren.Add("axis", axis.ToString());
83 rgChildren.Add("tiles", tiles.ToString());
84
85 return new RawProto(strName, "", rgChildren);
86 }
87
94 {
95 string strVal;
97
98 if ((strVal = rp.FindValue("axis")) != null)
99 p.axis = int.Parse(strVal);
100
101 if ((strVal = rp.FindValue("tiles")) != null)
102 p.tiles = int.Parse(strVal);
103
104 return p;
105 }
106 }
107}
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 used by the TileLayer
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
static TileParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
int tiles
Specifies the number of copies (tiles) of the blob to output.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
int axis
Specifies the index of the axis to tile.
TileParameter()
Constructor for the parameter.
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 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