2using System.Collections.Generic;
15 [TypeConverter(typeof(ExpandableObjectConverter))]
19 List<float> m_rgF =
new List<float>();
20 string m_strBinaryDataFile =
null;
30 [Description(
"Specifies the output shape.")]
33 get {
return m_outputShape; }
34 set { m_outputShape = value; }
48 [Description(
"Specifies a binary data file containing the values to load.")]
51 get {
return m_strBinaryDataFile; }
52 set { m_strBinaryDataFile = value; }
58 [Description(
"Specifies a set of float values used to fill the output. When only one item is specified, all outputs are set to that value.")]
62 set { m_rgF = value; }
71 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
90 m_rgF =
new List<float>(p.m_rgF);
105 private static string replace(
string str,
char chTarget,
char chReplace)
109 foreach (
char ch
in str)
130 rgChildren.
Add(m_outputShape.
ToProto(
"output_shape"));
131 rgChildren.
Add<
float>(
"valuef", m_rgF);
133 if (!
string.IsNullOrEmpty(m_strBinaryDataFile))
134 rgChildren.
Add(
"binary_data_file", replace(m_strBinaryDataFile,
' ',
'~'));
136 return new RawProto(strName,
"", rgChildren);
153 p.m_rgF = rp.FindArray<
float>(
"valuef");
155 strVal = rp.
FindValue(
"binary_data_file");
157 p.m_strBinaryDataFile = replace(strVal,
'~',
' ');
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.
static RawProto Parse(string str)
Parses a prototxt and places it in a new RawProto.
string FindValue(string strName)
Searches for a falue of a node within this nodes children.
Specifies the shape of a Blob.
override RawProto ToProto(string strName)
Converts the BlobShape to a RawProto.
BlobShape Clone()
Creates a copy of the BlobShape.
static BlobShape FromProto(RawProto rp)
Parse a new BlobShape from a RawProto.
Specifies the parameters for the ConstantLayer.
BlobShape output_shape
Specifies the output shape.
ConstantParameter()
Constructor for the parameter.
static ConstantParameter FromProto(RawProto rp)
Parses the parameter from a RawProto.
string binary_data_file
Specifies a binary data file containing the values to load.
List< float > values_f
Specifies a set of float values used to fill the output. When only one item is specified,...
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
override object Load(System.IO.BinaryReader br, bool bNewInstance=true)
Load the parameter from a binary reader.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
override void Copy(LayerParameterBase src)
Copy on parameter to another.
The LayerParameterBase is the base class for all other layer specific parameters.
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
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-...