2using System.Collections.Generic;
17 List<double> m_rgdfData =
new List<double>();
18 List<double> m_rgdfDiff =
new List<double>();
19 List<float> m_rgfData =
new List<float>();
20 List<float> m_rgfDiff =
new List<float>();
24 int? m_nChannels =
null;
25 int? m_nHeight =
null;
48 public void Save(BinaryWriter bw)
50 bool bHasShape = (m_rgShape !=
null) ?
true :
false;
61 bw.Write(m_nNum.HasValue);
63 bw.Write(m_nNum.Value);
65 bw.Write(m_nChannels.HasValue);
66 if (m_nChannels.HasValue)
67 bw.Write(m_nChannels.Value);
69 bw.Write(m_nHeight.HasValue);
70 if (m_nHeight.HasValue)
71 bw.Write(m_nHeight.Value);
73 bw.Write(m_nWidth.HasValue);
74 if (m_nWidth.HasValue)
75 bw.Write(m_nWidth.Value);
84 public object Load(BinaryReader br,
bool bNewInstance)
93 p.m_rgdfData =
Utility.Load<
double>(br);
94 p.m_rgdfDiff =
Utility.Load<
double>(br);
95 p.m_rgfData =
Utility.Load<
float>(br);
96 p.m_rgfDiff =
Utility.Load<
float>(br);
99 p.m_nNum = br.ReadInt32();
101 if (br.ReadBoolean())
102 p.m_nChannels = br.ReadInt32();
104 if (br.ReadBoolean())
105 p.m_nHeight = br.ReadInt32();
107 if (br.ReadBoolean())
108 p.m_nWidth = br.ReadInt32();
118 get {
return m_rgShape; }
119 set { m_rgShape = value; }
127 get {
return m_nNum; }
128 set { m_nNum = value; }
136 get {
return m_nChannels; }
137 set { m_nChannels = value; }
145 get {
return m_nHeight; }
146 set { m_nHeight = value; }
154 get {
return m_nWidth; }
155 set { m_nWidth = value; }
163 get {
return m_rgdfData; }
164 set { m_rgdfData = value; }
172 get {
return m_rgdfDiff; }
173 set { m_rgdfDiff = value; }
181 get {
return m_rgfData; }
182 set { m_rgfData = value; }
190 get {
return m_rgfDiff; }
191 set { m_rgfDiff = value; }
202 bp.m_rgdfData =
Utility.Clone<
double>(m_rgdfData);
203 bp.m_rgdfDiff =
Utility.Clone<
double>(m_rgdfDiff);
204 bp.m_rgfData =
Utility.Clone<
float>(m_rgfData);
205 bp.m_rgfDiff =
Utility.Clone<
float>(m_rgfDiff);
226 rgChildren.
Add(
"num",
num);
232 rgChildren.
Add<
float>(
"data",
data);
233 rgChildren.
Add<
float>(
"diff",
diff);
235 return new RawProto(strName,
"", rgChildren);
255 p.
double_data = rp.FindArray<
double>(
"double_data");
256 p.
double_diff = rp.FindArray<
double>(
"double_diff");
257 p.
data = rp.FindArray<
float>(
"data");
258 p.
diff = rp.FindArray<
float>(
"diff");
The BaseParameter class is the base class for all other parameter classes.
virtual bool Compare(BaseParameter p)
Compare this parameter to another parameter.
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.
RawProto FindChild(string strName)
Searches for a given node.
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
The Utility class provides general utility funtions.
static void Save(BinaryWriter bw, List< double > rg)
Save a list of double to a binary writer.
The BlobProto contains the descripion of a blob.
object Clone()
Copies the BlobProto and returns a new instance.
static BlobProto Load(BinaryReader br)
Load a new BlobProto from a binary reader.
List< float > data
Get/set the data as a List of float.
override RawProto ToProto(string strName)
Converts the BlobProto to a RawProto.
List< double > double_diff
Get/set the diff as a List of double.
object Load(BinaryReader br, bool bNewInstance)
Loads a BlobProto from a binary reader.
BlobShape shape
Specifies the shape of the Blob.
List< double > double_data
Get/set the data as a List of double.
int? num
Specifies the number of inputs (such as images) in the Blob.
List< float > diff
Get/set the diff as a List of float.
int CompareTo(object obj)
Compares the BlobProto to another BlobProto.
int? height
Specifies the height of each input.
int? channels
Specifies the number of images per input.
static BlobProto FromProto(RawProto rp)
Parses a new BlobProto from a RawProto.
BlobProto()
Constructor for the BlobProto.
BlobProto(List< int > rgShape)
Constructor for the BlobProto
int? width
Specifies the width of each input.
void Save(BinaryWriter bw)
Saves the BlobProto to a binary writer.
Specifies the shape of a Blob.
override RawProto ToProto(string strName)
Converts the BlobShape to a RawProto.
static BlobShape FromProto(RawProto rp)
Parse a new BlobShape from a RawProto.
object Load(BinaryReader br, bool bNewInstance)
Load the BlobShape from a binary reader.
List< int > dim
The blob shape dimensions.
void Save(BinaryWriter bw)
Save the BlobShape to a binary writer.
The IBinaryPersist interface provides generic save and load functionality.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
The MyCaffe.common namespace contains common MyCaffe classes.
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-...