MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
ConcatParameter.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
6using MyCaffe.basecode;
7
8namespace MyCaffe.param
9{
19 [Serializable]
20 [TypeConverter(typeof(ExpandableObjectConverter))]
22 {
23 int m_nAxis = 1;
24 uint? m_nConcatDim = null;
25
28 {
29 }
30
38 [Description("The axis along which to concatenate - may be negative to index from the end (e.g., -1 for the last axis). Other axes must have the same dimension for all the bottom blobs. By default, the ConcatLayer concatenates blobs along the 'channel' axis 1.")]
39 public int axis
40 {
41 get { return m_nAxis; }
42 set { m_nAxis = value; }
43 }
44
48 [Description("DEPRECIATED - use 'axis' instead.")]
49 public uint? concat_dim
50 {
51 get { return m_nConcatDim; }
52 set { m_nConcatDim = value; }
53 }
54
56 public override object Load(System.IO.BinaryReader br, bool bNewInstance = true)
57 {
58 RawProto proto = RawProto.Parse(br.ReadString());
59 ConcatParameter p = FromProto(proto);
60
61 if (!bNewInstance)
62 Copy(p);
63
64 return p;
65 }
66
68 public override void Copy(LayerParameterBase src)
69 {
71 m_nAxis = p.m_nAxis;
72 m_nConcatDim = p.m_nConcatDim;
73 }
74
76 public override LayerParameterBase Clone()
77 {
79 p.Copy(this);
80 return p;
81 }
82
88 public override RawProto ToProto(string strName)
89 {
90 RawProtoCollection rgChildren = new RawProtoCollection();
91
92 if (axis != 1)
93 rgChildren.Add("axis", axis.ToString());
94
95 if (concat_dim.HasValue)
96 rgChildren.Add("concat_dim", concat_dim.Value.ToString());
97
98 return new RawProto(strName, "", rgChildren);
99 }
100
107 {
108 string strVal;
110
111 if ((strVal = rp.FindValue("axis")) != null)
112 p.axis = int.Parse(strVal);
113
114 if ((strVal = rp.FindValue("concat_dim")) != null)
115 p.concat_dim = uint.Parse(strVal);
116
117 return p;
118 }
119 }
120}
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
Specifies the parameters for the ConcatLayer
uint? concat_dim
DEPRECIATED: alias for 'axis' – does not support negative indexing.
int axis
The axis along which to concatenate – may be negative to index from the end (e.g.,...
override void Copy(LayerParameterBase src)
Copy on parameter to another.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
static ConcatParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
ConcatParameter()
Constructor for the parameter.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
The LayerParameterBase is the base class for all other layer specific parameters.
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