2using System.Collections.Generic;
14 [TypeConverter(typeof(ExpandableObjectConverter))]
17 string m_strEncoderSource =
null;
18 string m_strDecoderSource =
null;
19 uint m_nBatchSize = 1;
20 uint m_nTimeSteps = 80;
21 uint m_nSampleSize = 1000;
22 bool m_bShuffle =
true;
23 bool m_bEnableNormalEncoderOutput =
true;
24 bool m_bEnableReverseEncoderOutput =
true;
44 int nBatch = (int)m_nBatchSize;
46 strInput +=
"input: \"idec\"" + Environment.NewLine;
47 strInput +=
"input_shape { dim: 1 dim: " + nBatch.ToString() +
" dim: 1 } " + Environment.NewLine;
49 strInput +=
"input: \"ienc\"" + Environment.NewLine;
50 strInput +=
"input_shape { dim: " + m_nTimeSteps.ToString() +
" dim: " + nBatch.ToString() +
" dim: 1 } " + Environment.NewLine;
52 strInput +=
"input: \"iencr\"" + Environment.NewLine;
53 strInput +=
"input_shape { dim: " + m_nTimeSteps.ToString() +
" dim: " + nBatch.ToString() +
" dim: 1 } " + Environment.NewLine;
55 strInput +=
"input: \"iencc\"" + Environment.NewLine;
56 strInput +=
"input_shape { dim: " + m_nTimeSteps.ToString() +
" dim: " + nBatch.ToString() +
" } " + Environment.NewLine;
75 [Description(
"Specifies the encoder data source.")]
78 get {
return m_strEncoderSource; }
79 set { m_strEncoderSource = value; }
85 [Description(
"Specifies the decoder data source.")]
88 get {
return m_strDecoderSource; }
89 set { m_strDecoderSource = value; }
95 [Description(
"Specifies the batch size of images to collect and train on each iteration of the network. NOTE: Setting the training netorks batch size >= to the testing net batch size will conserve memory by allowing the training net to share its gpu memory with the testing net.")]
98 get {
return m_nBatchSize; }
105 if (args.
Error !=
null)
109 m_nBatchSize = value;
116 [Description(
"Specifies the maximum length for the encoder inputs.")]
119 get {
return m_nTimeSteps; }
120 set { m_nTimeSteps = value; }
126 [Description(
"Specifies the sample size to select from the data sources.")]
129 get {
return m_nSampleSize; }
130 set { m_nSampleSize = value; }
136 [Description(
"Specifies whether to shuffle the data or not.")]
139 get {
return m_bShuffle; }
140 set { m_bShuffle = value; }
146 [Description(
"When enabled, the normal ordered encoder data is output (default = true).")]
149 get {
return m_bEnableNormalEncoderOutput; }
150 set { m_bEnableNormalEncoderOutput = value; }
156 [Description(
"When enabled, the reverse ordered encoder data is output (default = true).")]
159 get {
return m_bEnableReverseEncoderOutput; }
160 set { m_bEnableReverseEncoderOutput = value; }
164 public override object Load(
System.IO.BinaryReader br,
bool bNewInstance =
true)
179 m_strEncoderSource = p.m_strEncoderSource;
180 m_strDecoderSource = p.m_strDecoderSource;
181 m_nBatchSize = p.m_nBatchSize;
182 m_nTimeSteps = p.m_nTimeSteps;
183 m_nSampleSize = p.m_nSampleSize;
184 m_bShuffle = p.m_bShuffle;
185 m_bEnableNormalEncoderOutput = p.m_bEnableNormalEncoderOutput;
186 m_bEnableReverseEncoderOutput = p.m_bEnableReverseEncoderOutput;
211 rgChildren.
Add(
"shuffle",
shuffle.ToString());
215 return new RawProto(strName,
"", rgChildren);
231 if ((strVal = rp.
FindValue(
"encoder_source")) !=
null)
232 p.encoder_source = strVal.Trim(
'\"');
234 if ((strVal = rp.
FindValue(
"decoder_source")) !=
null)
235 p.decoder_source = strVal.Trim(
'\"');
237 if ((strVal = rp.
FindValue(
"batch_size")) !=
null)
238 p.batch_size = uint.Parse(strVal);
240 if ((strVal = rp.
FindValue(
"time_steps")) !=
null)
241 p.time_steps = uint.Parse(strVal);
243 if ((strVal = rp.
FindValue(
"shuffle")) !=
null)
244 p.shuffle =
bool.Parse(strVal);
246 if ((strVal = rp.
FindValue(
"enable_normal_encoder_output")) !=
null)
247 p.enable_normal_encoder_output =
bool.Parse(strVal);
249 if ((strVal = rp.
FindValue(
"enable_reverse_encoder_output")) !=
null)
250 p.enable_reverse_encoder_output =
bool.Parse(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.
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.
The LayerParameterBase is the base class for all other layer specific parameters.
Specifies the base parameter for all layers.
List< string > bottom
Specifies the active bottom connections (in the bottom, out the top).
Specifies the parameter for the Text data layer.
TextDataParameter()
Constructor for the parameter.
override void PrepareRunModel(LayerParameter p)
This method gives derivative classes a chance modify the layer parameter for a run model.
bool enable_reverse_encoder_output
When enabled, the reverse ordered encoder data is output (default = true).
uint sample_size
Specifies the sample size to select from the data sources.
override LayerParameterBase Clone()
Creates a new copy of this instance of the parameter.
EventHandler< VerifyBatchSizeArgs > OnVerifyBatchSize
This event is, optionally, called to verify the batch size of the TextDataParameter.
uint time_steps
Specifies the maximum length for each encoder input.
override string PrepareRunModelInputs()
This method gives derivative classes a chance specify model inputs required by the run model.
bool shuffle
Specifies the whether to shuffle the data or now.
bool enable_normal_encoder_output
When enabled, the normal ordered encoder data is output (default = true).
string decoder_source
Specifies the decoder data source.
override RawProto ToProto(string strName)
Convert the parameter into a RawProto.
virtual uint batch_size
Specifies the batch size.
string encoder_source
Specifies the encoder data source.
static TextDataParameter FromProto(RawProto rp, TextDataParameter p=null)
Parses the parameter from a RawProto.
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.
The VerifyBatchSizeArgs class defines the arguments of the OnVerifyBatchSize event.
Exception Error
Get/set the error value. For example if the receiver of the event determines that the batch size is i...
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-...