ModelConfig.proto 21.0 KB
Newer Older
1
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
Z
zhangjinchao01 已提交
2 3 4 5 6 7 8 9 10 11 12 13

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
Y
Yu Yang 已提交
14
syntax = "proto2";
Z
zhangjinchao01 已提交
15 16 17 18 19 20 21 22

import "ParameterConfig.proto";

package paddle;

/**
 * Various structs for the configuration of a neural network
 */
Y
Yu Yang 已提交
23

Z
zhangjinchao01 已提交
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
message ExternalConfig {
  repeated string layer_names = 1;
  repeated string input_layer_names = 2;
  repeated string output_layer_names = 3;
}

message ActivationConfig {
  // identity: f(x) = x
  // sigmoid: f(x) = 1 / (1 + exp(-x))
  // logistic: f(x) = (1 - exp(-x)) / (1+ exp(-x))
  // softmax: y_i = f(x_i) = exp(x_i) / (\sum_i exp(x_i))
  // relu: y = max(0, x)
  required string type = 1;
};

message ConvConfig {
  // filter_size = 5, says that this layer will use
  // filters of size 5x5 pixels.
  required uint32 filter_size = 1;

  // The image data dimensionality.
  // This value must be either 1, 2, 3, or a multiple of 4.
  required uint32 channels = 2;

  // stride = 1, indicates that the distance between
  // successive filter applications should be 1 pixel.
  required uint32 stride = 3;

  // padding = 4, instructs the net to implicitly
  // pad the images with a 4-pixel border of zeros.
  required uint32 padding = 4;

  // If groups = 4 together with the filters = 32 parameter,
  // they state that this convolutional layer is to have 4
  // groups of 32 filters. Each filter will connect to 8
  // input channels.
  required uint32 groups = 5;
  required uint32 filter_channels = 6;

  // The size of output feature map.
  required uint32 output_x = 7;

  // The size of input feature map.
  required uint32 img_size = 8;

  // caffe mode for output size coherence
L
liaogang 已提交
70
  required bool caffe_mode = 9 [ default = true ];
Z
zhangjinchao01 已提交
71 72 73 74 75 76 77 78

  // if filter_size_y is set , this convolutional layer will use
  // filters of size filter_size * filter_size_y pixels.
  // if filter_size_y is not set, this convolutional layer will use
  // filters of size filter_size * filter_size
  required uint32 filter_size_y = 10;
  required uint32 padding_y = 11;
  required uint32 stride_y = 12;
L
Luo Tao 已提交
79 80

  // if not set, use output_x
L
Luo Tao 已提交
81
  optional uint32 output_y = 13;
L
Luo Tao 已提交
82 83

  // if not set, use img_size
L
Luo Tao 已提交
84
  optional uint32 img_size_y = 14;
C
chengduoZH 已提交
85

W
wanghaoshuang 已提交
86 87
  optional uint32 dilation = 15 [ default = 1 ];
  optional uint32 dilation_y = 16 [ default = 1 ];
C
chengduoZH 已提交
88 89 90 91 92 93

  optional uint32 filter_size_z = 17 [ default = 1 ];
  optional uint32 padding_z = 18 [ default = 1 ];
  optional uint32 stride_z = 19 [ default = 1 ];
  optional uint32 output_z = 20 [ default = 1 ];
  optional uint32 img_size_z = 21 [ default = 1 ];
Z
zhangjinchao01 已提交
94 95 96 97 98 99 100 101 102 103 104 105
}

message PoolConfig {
  // max or avg pooling
  required string pool_type = 1;
  required uint32 channels = 2;

  // Defines the size of the pooling region in
  // the x (equivalently, y) dimension.
  required uint32 size_x = 3;

  // Tell the net where in the input image to start the pooling.
106 107
  // start is deprecated now.
  optional uint32 start = 4;
Z
zhangjinchao01 已提交
108 109

  // Defines the stride size between successive pooling squares.
L
liaogang 已提交
110
  required uint32 stride = 5 [ default = 1 ];
Z
zhangjinchao01 已提交
111 112 113 114 115 116 117 118 119

  // The size of output feature map.
  required uint32 output_x = 6;

  // The size of input feature map.
  required uint32 img_size = 7;

  // padding = 4, instructs the net to implicitly
  // pad the images with a 4-pixel border of zeros.
L
liaogang 已提交
120
  optional uint32 padding = 8 [ default = 0 ];
Z
zhangjinchao01 已提交
121 122

  // if not set, use size_x
D
dangqingqing 已提交
123
  optional uint32 size_y = 9;
Z
zhangjinchao01 已提交
124 125

  // if not set, use stride
D
dangqingqing 已提交
126
  optional uint32 stride_y = 10;
Z
zhangjinchao01 已提交
127 128

  // if not set, use output_x
D
dangqingqing 已提交
129
  optional uint32 output_y = 11;
Z
zhangjinchao01 已提交
130 131

  // if not set, use img_size
D
dangqingqing 已提交
132
  optional uint32 img_size_y = 12;
Z
zhangjinchao01 已提交
133 134

  // if not set, use padding
D
dangqingqing 已提交
135
  optional uint32 padding_y = 13;
C
chengduoZH 已提交
136 137 138 139 140 141

  optional uint32 size_z = 14 [ default = 1 ];
  optional uint32 stride_z = 15 [ default = 1 ];
  optional uint32 output_z = 16 [ default = 1 ];
  optional uint32 img_size_z = 17 [ default = 1 ];
  optional uint32 padding_z = 18 [ default = 1 ];
142

143
  optional bool exclude_mode = 19;
Z
zhangjinchao01 已提交
144 145
}

Q
qijun 已提交
146
message SppConfig {
L
Luo Tao 已提交
147 148 149
  required ImageConfig image_conf = 1;
  required string pool_type = 2;
  required uint32 pyramid_height = 3;
Q
qijun 已提交
150 151
}

Z
zhangjinchao01 已提交
152 153 154 155 156 157 158 159 160 161 162 163 164
message NormConfig {
  // rnorm or cmrnorm
  required string norm_type = 1;
  required uint32 channels = 2;

  // rnorm: this defines the size of the local regions
  // used for response normalization.
  // cmrnorm: The size parameter indicates how many
  // nearby maps to use for normalization.
  required uint32 size = 3;

  // the parameters for normalization
  // u = u / (1+scale*sum(u^2 in window))^pow
Y
Yu Yang 已提交
165 166
  required double scale = 4;
  required double pow = 5;
Z
zhangjinchao01 已提交
167 168 169 170 171 172 173 174 175 176 177 178

  // The size of output feature map.
  required uint32 output_x = 6;

  // The size of input feature map.
  required uint32 img_size = 7;

  // normalize with fixed window or sliding window
  // u = u / (1+scale*sum(u^2 in window))^pow
  // fixed window: shared a fixed window for each value
  // sliding window: have a different window for each value
  optional bool blocked = 8;
L
Luo Tao 已提交
179 180

  // if not set, use output_x
L
Luo Tao 已提交
181
  optional uint32 output_y = 9;
L
Luo Tao 已提交
182 183

  // if not set, use img_size
L
Luo Tao 已提交
184
  optional uint32 img_size_y = 10;
Z
zhangjinchao01 已提交
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
}

message BlockExpandConfig {
  required uint32 channels = 1;

  required uint32 stride_x = 2;
  required uint32 stride_y = 3;

  required uint32 padding_x = 4;
  required uint32 padding_y = 5;

  required uint32 block_x = 6;
  required uint32 block_y = 7;

  // The size of output feature map.
  required uint32 output_x = 8;
  required uint32 output_y = 9;

  // The size of input feature map.
  required uint32 img_size_x = 10;
  required uint32 img_size_y = 11;
}

208
message MaxOutConfig {
L
Luo Tao 已提交
209
  required ImageConfig image_conf = 1;
210 211 212
  required uint32 groups = 2;
}

L
liaogang 已提交
213
message RowConvConfig { required uint32 context_length = 1; }
214

H
hedaoyuan 已提交
215 216 217
message SliceConfig {
  required uint32 start = 1;
  required uint32 end = 2;
218 219
}

Z
zhangjinchao01 已提交
220 221 222 223 224 225 226 227 228
message ProjectionConfig {
  required string type = 1;
  required string name = 2;
  required uint64 input_size = 3;
  required uint64 output_size = 4;

  // For ShiftProjection
  optional int32 context_start = 5;
  optional int32 context_length = 6;
L
liaogang 已提交
229
  optional bool trainable_padding = 7 [ default = false ];
Z
zhangjinchao01 已提交
230 231 232 233 234 235

  // For convolution
  optional ConvConfig conv_conf = 8;
  optional int32 num_filters = 9;

  // For IdentityOffsetProjection
L
liaogang 已提交
236
  optional uint64 offset = 11 [ default = 0 ];
Q
qijun 已提交
237 238 239

  // For pool
  optional PoolConfig pool_conf = 12;
H
hedaoyuan 已提交
240 241

  // For slice
242 243
  // Each slice output is the input[start, end)
  repeated SliceConfig slices = 13;
Z
zhangjinchao01 已提交
244 245 246 247 248 249 250 251 252
}

message OperatorConfig {
  required string type = 1;
  repeated int32 input_indices = 2;
  repeated uint64 input_sizes = 3;
  required uint64 output_size = 4;

  // For DotMulOperator
L
liaogang 已提交
253
  optional double dotmul_scale = 5 [ default = 1.0 ];
Z
zhangjinchao01 已提交
254 255 256 257 258 259

  // For ConvOperator
  optional ConvConfig conv_conf = 6;
  optional int32 num_filters = 7;
}

L
liaogang 已提交
260
message BilinearInterpConfig {
L
liaogang 已提交
261
  // The size of input feature map.
L
Luo Tao 已提交
262
  required ImageConfig image_conf = 1;
L
liaogang 已提交
263
  // The size of output feature map.
L
Luo Tao 已提交
264 265
  required uint32 out_size_x = 2;
  required uint32 out_size_y = 3;
L
liaogang 已提交
266
}
Z
zhangjinchao01 已提交
267 268 269 270 271 272 273 274

message ImageConfig {
  // The image data dimensionality.
  // This value must be either 1, 2, 3, or a multiple of 4.
  required uint32 channels = 2;

  // The size of input feature map.
  required uint32 img_size = 8;
275
  optional uint32 img_size_y = 9;
276
  optional uint32 img_size_z = 10 [ default = 1 ];
Z
zhangjinchao01 已提交
277 278
}

Y
yuan 已提交
279 280 281 282 283 284 285
message PriorBoxConfig {
  repeated uint32 min_size = 1;
  repeated uint32 max_size = 2;
  repeated float aspect_ratio = 3;
  repeated float variance = 4;
}

D
dangqingqing 已提交
286 287 288 289 290 291 292
message PadConfig {
  required ImageConfig image_conf = 1;
  repeated uint32 pad_c = 2;
  repeated uint32 pad_h = 3;
  repeated uint32 pad_w = 4;
}

293
message ReshapeConfig {
W
wanghaoshuang 已提交
294 295
  repeated uint32 height_axis = 1;
  repeated uint32 width_axis = 2;
296 297
}

298 299 300 301 302 303 304
message MultiBoxLossConfig {
  required uint32 num_classes = 1;
  required float overlap_threshold = 2;
  required float neg_pos_ratio = 3;
  required float neg_overlap = 4;
  required uint32 background_id = 5;
  required uint32 input_num = 6;
L
liaogang 已提交
305 306
  optional uint32 height = 7 [ default = 1 ];
  optional uint32 width = 8 [ default = 1 ];
307 308 309 310 311 312 313 314 315 316
}

message DetectionOutputConfig {
  required uint32 num_classes = 1;
  required float nms_threshold = 2;
  required uint32 nms_top_k = 3;
  required uint32 background_id = 4;
  required uint32 input_num = 5;
  required uint32 keep_top_k = 6;
  required float confidence_threshold = 7;
L
liaogang 已提交
317 318
  optional uint32 height = 8 [ default = 1 ];
  optional uint32 width = 9 [ default = 1 ];
319 320
}

G
guosheng 已提交
321
message ClipConfig {
322 323
  required double min = 1;
  required double max = 2;
324 325
}

X
xzl 已提交
326 327 328 329 330 331 332 333 334 335
message UpsampleConfig {
  required ImageConfig image_conf = 1;
  optional uint32 scale = 2 [ default = 2 ];
  optional uint32 scale_y = 3 [ default = 2 ];
  optional bool pad_out_x = 4 [ default = false ];
  optional bool pad_out_y = 5 [ default = false ];
  optional uint32 upsample_size = 6;
  optional uint32 upsample_size_y = 7;
}

G
guosheng 已提交
336 337 338 339
message ROIPoolConfig {
  required uint32 pooled_width = 1;
  required uint32 pooled_height = 2;
  required float spatial_scale = 3;
340 341
  optional uint32 height = 4 [ default = 1 ];
  optional uint32 width = 5 [ default = 1 ];
G
guosheng 已提交
342 343
}

Y
yangyaming 已提交
344
message ScaleSubRegionConfig {
Y
yangyaming 已提交
345 346 347 348
  required ImageConfig image_conf = 1;
  required float value = 2;
}

Z
zhangjinchao01 已提交
349 350 351 352 353 354 355 356 357 358 359 360
message LayerInputConfig {
  required string input_layer_name = 1;
  optional string input_parameter_name = 2;
  optional ConvConfig conv_conf = 3;
  optional PoolConfig pool_conf = 4;
  optional NormConfig norm_conf = 5;
  optional ProjectionConfig proj_conf = 6;
  optional BlockExpandConfig block_expand_conf = 7;
  optional ImageConfig image_conf = 8;
  // If the input layer has multi-output.
  // Set the argument name.
  optional string input_layer_argument = 9;
L
liaogang 已提交
361
  optional BilinearInterpConfig bilinear_interp_conf = 10;
L
liaogang 已提交
362
  optional MaxOutConfig maxout_conf = 11;
Q
qijun 已提交
363
  optional SppConfig spp_conf = 12;
Y
yuan 已提交
364
  optional PriorBoxConfig priorbox_conf = 13;
D
dangqingqing 已提交
365
  optional PadConfig pad_conf = 14;
366
  optional RowConvConfig row_conv_conf = 15;
367 368
  optional MultiBoxLossConfig multibox_loss_conf = 16;
  optional DetectionOutputConfig detection_output_conf = 17;
G
guosheng 已提交
369
  optional ClipConfig clip_conf = 18;
Y
yangyaming 已提交
370
  optional ScaleSubRegionConfig scale_sub_region_conf = 19;
371
  optional ROIPoolConfig roi_pool_conf = 20;
X
xzl 已提交
372
  optional UpsampleConfig upsample_conf = 21;
Z
zhangjinchao01 已提交
373 374 375 376 377 378
}

message LayerConfig {
  required string name = 1;
  required string type = 2;
  optional uint64 size = 3;
L
liaogang 已提交
379
  // optional ActivationConfig activation = 4;
Z
zhangjinchao01 已提交
380 381 382 383 384 385 386 387 388 389 390 391
  optional string active_type = 4;
  repeated LayerInputConfig inputs = 5;
  optional string bias_parameter_name = 6;

  // This number must be a multiple of 16.
  optional uint32 num_filters = 7;

  // indicates that the biases of every filter in this layer
  // should be shared amongst all applications of that filter
  // (which is how convnets are usually trained). Setting this to
  // false will untie the biases, yielding a separate bias for
  // every location at which the filter is applied.
L
liaogang 已提交
392
  optional bool shared_biases = 8 [ default = false ];
Z
zhangjinchao01 已提交
393 394 395 396 397 398 399 400 401

  // Valid values are ones that divide the area of the output
  // grid in this convolutional layer. For example if this layer
  // produces 32-channel 20x20 output grid, valid values of
  // partialSum are ones which divide 20*20 = 400.
  // I'll update this comments when confirmed
  optional uint32 partial_sum = 9;

  // for dropout
Y
Yu Yang 已提交
402
  optional double drop_rate = 10;
Z
zhangjinchao01 已提交
403 404 405 406 407 408 409

  // for HierarchicalSoftmaxLayer and NCELayer
  // the number of classes
  optional uint32 num_classes = 11;

  // the gpu device which the Layer's data in.
  // Only used by ParallelNeuralNetork. Ignored otherwise.
L
liaogang 已提交
410
  optional int32 device = 12 [ default = -1 ];
Z
zhangjinchao01 已提交
411

L
liaogang 已提交
412 413 414
  // for recurrent layer. If true, the recurrence runs from the end to the
  // beginning.
  optional bool reversed = 13 [ default = false ];
Z
zhangjinchao01 已提交
415

L
liaogang 已提交
416 417 418
  // for lstmemory layer. Different types of nodes have different activation
  // type.
  optional string active_gate_type = 14;
Z
zhangjinchao01 已提交
419 420 421 422
  optional string active_state_type = 15;

  // For NCELayer
  // The number of random negative labels for each sample
L
liaogang 已提交
423
  optional int32 num_neg_samples = 16 [ default = 10 ];
Z
zhangjinchao01 已提交
424 425 426 427

  // For NCELayer
  // The distribution for generating the random negative labels.
  // A uniform distribution will be used if not provided
L
liaogang 已提交
428
  repeated double neg_sampling_dist = 17 [ packed = true ];
Z
zhangjinchao01 已提交
429 430 431

  // For MaxLayer
  // default: output VALUE of MaxLayer. set this flag to true for output INDEX
Y
Yu Yang 已提交
432
  // INDEX will be put in Argument::value as double values.
L
liaogang 已提交
433
  optional bool output_max_index = 19 [ default = false ];
Z
zhangjinchao01 已提交
434 435 436 437

  /// The filed number 20 have been deprecated.

  // For self-normalized estimation
L
liaogang 已提交
438
  optional double softmax_selfnorm_alpha = 21 [ default = 0.1 ];
Z
zhangjinchao01 已提交
439 440 441 442 443 444 445 446 447 448

  /// The filed numbers 22 and 23 have been deprecated.

  // for MDLstmLayer
  repeated bool directions = 24;

  // for CTCLayer
  optional bool norm_by_times = 25;

  // for CostLayers
L
liaogang 已提交
449
  optional double coeff = 26 [ default = 1.0 ];
Z
zhangjinchao01 已提交
450 451 452 453 454 455

  // for AverageLayer
  // can be set to: 'average', 'sum' or 'squarerootn'
  optional string average_strategy = 27;

  // for error clipping
L
liaogang 已提交
456
  optional double error_clipping_threshold = 28 [ default = 0.0 ];
Z
zhangjinchao01 已提交
457 458 459 460 461 462 463 464 465

  // for operators used by mixed layer
  repeated OperatorConfig operator_confs = 29;

  // for lambdaCost
  optional int32 NDCG_num = 30;
  optional int32 max_sort_size = 31;

  // for SlopeInterceptLayer
Y
Yu Yang 已提交
466 467
  optional double slope = 32;
  optional double intercept = 33;
Z
zhangjinchao01 已提交
468 469

  // for CosSimVecMatLayer and CosSimLayer
Y
Yu Yang 已提交
470
  optional double cos_scale = 34;
Z
zhangjinchao01 已提交
471 472 473 474 475 476 477 478 479 480 481 482 483

  // for DataNormLayer
  // can be set to: 'z-score', 'min-max' or 'decimal-scaling'
  optional string data_norm_strategy = 36;

  // for bos/eos id
  optional uint32 bos_id = 37;
  optional uint32 eos_id = 38;

  // for max id layer
  optional uint32 beam_size = 39;

  // for seqlastins layer, whether select first instead last
L
liaogang 已提交
484
  optional bool select_first = 40 [ default = false ];
Z
zhangjinchao01 已提交
485 486 487

  // for seqlastins layer, AverageLayer, MaxLayer and ExpandLayer
  // can be set to: 'non-seq','seq'
L
liaogang 已提交
488
  optional string trans_type = 41 [ default = 'non-seq' ];
Z
zhangjinchao01 已提交
489 490 491

  // to indicate whether selective_fc layer
  // is used in sequence generation or not
L
liaogang 已提交
492
  optional bool selective_fc_pass_generation = 42 [ default = false ];
Z
zhangjinchao01 已提交
493 494 495 496 497 498

  // to indicate whether selective_fc layer take its last input to
  // selected several columns and only compute the multiplications
  // between the input matrices and the selected columns of
  // the parameter matrices of this layer.
  // if set false, selective_fc degrades into fc.
L
liaogang 已提交
499
  optional bool has_selected_colums = 43 [ default = true ];
Z
zhangjinchao01 已提交
500 501 502 503 504

  // this parameter is for speed consideration.
  // if number of the selected columns is less than
  // sample number * selective_fc output size * selective_fc_mull_mull_ratio
  // sparse multiplication is used, otherwise, using full multiplication.
L
liaogang 已提交
505
  optional double selective_fc_full_mul_ratio = 44 [ default = 0.02 ];
Z
zhangjinchao01 已提交
506 507 508 509

  // to indicate how many threads selective_fc use to to accelate
  // the plain_mul period
  // leave empty or set to 0 to disable multi-thread accleleration
L
liaogang 已提交
510 511
  optional uint32 selective_fc_parallel_plain_mul_thread_num = 45
      [ default = 0 ];
Z
zhangjinchao01 已提交
512 513 514 515 516 517

  // for batch normalization layer
  // if set use_global_stats true, will use the loaded mean and variance.
  optional bool use_global_stats = 46;

  // use to compute moving mean and variance.
L
liaogang 已提交
518
  optional double moving_average_fraction = 47 [ default = 0.9 ];
519 520

  // bias size
L
liaogang 已提交
521
  optional uint32 bias_size = 48 [ default = 0 ];
H
Haichao-Zhang 已提交
522

523
  // this parameter can be used as a user-defined parameter when necessary,
H
Haichao-Zhang 已提交
524
  // without changing the proto file.
525
  // e.g., when a new layer with a user-defined parameter is implemented,
H
Haichao-Zhang 已提交
526 527
  // it can be used to pass that parameter, without modifying the proto file.
  // string type is used for flexibility: different types can be converted
528
  // to string and reinterpreted in the user's own layer implementation.
H
Haichao-Zhang 已提交
529
  optional string user_arg = 49;
530

L
Luo Tao 已提交
531 532 533
  // to indicate rectangle image data
  optional uint64 height = 50;
  optional uint64 width = 51;
H
Haichao-Zhang 已提交
534

L
Liu Yiqun 已提交
535
  // blank label used in ctc loss
L
liaogang 已提交
536
  optional uint32 blank = 52 [ default = 0 ];
537

538
  // stride parameter for seqlastins layer, AverageLayer, MaxLayer, which
539 540
  // controls the scope of pooling operation. can be set > 0.
  // leave empty or set to -1 to disable this stride pooling.
L
liaogang 已提交
541
  optional int32 seq_pool_stride = 53 [ default = -1 ];
542 543

  // for crop layer
L
liaogang 已提交
544
  optional int32 axis = 54 [ default = 2 ];
545 546
  repeated uint32 offset = 55;
  repeated uint32 shape = 56;
W
wanghaoshuang 已提交
547

L
Luo Tao 已提交
548 549
  // for HuberRegressionLoss
  optional double delta = 57 [ default = 1.0 ];
C
chengduoZH 已提交
550

C
chengduoZH 已提交
551
  // for 3D data
C
chengduoZH 已提交
552
  optional uint64 depth = 58 [ default = 1 ];
W
wanghaoshuang 已提交
553 554

  // for switch order layer
555
  optional ReshapeConfig reshape_conf = 59;
P
peterzhang2029 已提交
556 557

  // for batch normalization layer
P
peterzhang2029 已提交
558
  // The small constant added to the variance to improve numeric stability.
P
peterzhang2029 已提交
559
  optional double epsilon = 60 [ default = 0.00001 ];
560

561
  // for factorization machine layer
562
  optional uint32 factor_size = 61;
Z
zhangjinchao01 已提交
563 564 565 566 567 568 569 570
}

message EvaluatorConfig {
  required string name = 1;
  required string type = 2;
  repeated string input_layers = 3;

  // Used by ChunkEvaluator
571 572 573 574
  // one of "IOB", "IOE", "IOBES"
  optional string chunk_scheme = 4;
  // number of chunk types other than "other"
  optional int32 num_chunk_types = 5;
Z
zhangjinchao01 已提交
575 576 577

  // Used by PrecisionRecallEvaluator and ClassificationErrorEvaluator
  // For multi binary labels: true if output > classification_threshold
L
liaogang 已提交
578
  optional double classification_threshold = 6 [ default = 0.5 ];
Z
zhangjinchao01 已提交
579
  // The positive label. -1 means average precision and recall
L
liaogang 已提交
580
  optional int32 positive_label = 7 [ default = -1 ];
Z
zhangjinchao01 已提交
581 582 583 584 585 586 587 588

  // load dict from this file
  optional string dict_file = 8;

  // dump result in this file
  optional string result_file = 9;

  // top # results for max id printer
L
liaogang 已提交
589
  optional int32 num_results = 10 [ default = 1 ];
Z
zhangjinchao01 已提交
590 591

  // whether to delimit the sequence in the seq_text_printer
L
liaogang 已提交
592
  optional bool delimited = 11 [ default = true ];
593

P
Peng Li 已提交
594 595 596
  // Used by ChunkEvaluator
  // chunk of these types are not counted
  repeated int32 excluded_chunk_types = 12;
L
Liang Zhao 已提交
597 598 599

  // Used by ClassificationErrorEvaluator
  // top # classification error
L
liaogang 已提交
600
  optional int32 top_k = 13 [ default = 1 ];
Y
yangyaming 已提交
601 602

  // Used by DetectionMAPEvaluator
L
liaogang 已提交
603
  optional double overlap_threshold = 14 [ default = 0.5 ];
Y
yangyaming 已提交
604

L
liaogang 已提交
605
  optional int32 background_id = 15 [ default = 0 ];
Y
yangyaming 已提交
606

L
liaogang 已提交
607
  optional bool evaluate_difficult = 16 [ default = false ];
Y
yangyaming 已提交
608

L
liaogang 已提交
609
  optional string ap_type = 17 [ default = "11point" ];
Z
zhangjinchao01 已提交
610 611 612 613 614 615
}

message LinkConfig {
  required string layer_name = 1;
  required string link_name = 2;
  // If true, this link has sub-sequence
L
liaogang 已提交
616
  optional bool has_subseq = 3 [ default = false ];
Z
zhangjinchao01 已提交
617 618 619 620 621 622 623 624 625 626 627 628
}

message MemoryConfig {
  required string layer_name = 1;
  required string link_name = 2;

  optional string boot_layer_name = 3;
  optional string boot_bias_parameter_name = 4;
  optional string boot_bias_active_type = 5;
  optional uint32 boot_with_const_id = 7;

  // memory is a sequence, initailized by a sequence boot layer
L
liaogang 已提交
629
  optional bool is_sequence = 6 [ default = false ];
Z
zhangjinchao01 已提交
630 631 632 633 634
}

message GeneratorConfig {
  required uint32 max_num_frames = 1;
  required string eos_layer_name = 2;
L
liaogang 已提交
635
  optional int32 num_results_per_sample = 3 [ default = 1 ];
Z
zhangjinchao01 已提交
636 637

  // for beam search
L
liaogang 已提交
638
  optional int32 beam_size = 4 [ default = 1 ];
Z
zhangjinchao01 已提交
639

L
liaogang 已提交
640
  optional bool log_prob = 5 [ default = true ];
Z
zhangjinchao01 已提交
641 642 643 644 645 646 647 648 649
}

message SubModelConfig {
  required string name = 1;
  repeated string layer_names = 2; // selected layers in sub model
  repeated string input_layer_names = 3;
  repeated string output_layer_names = 4;
  repeated string evaluator_names = 5;

L
liaogang 已提交
650
  optional bool is_recurrent_layer_group = 6 [ default = false ];
Z
zhangjinchao01 已提交
651 652

  // If true, the recurrence runs from the end to the beginning.
L
liaogang 已提交
653
  optional bool reversed = 7 [ default = false ];
Z
zhangjinchao01 已提交
654 655 656 657 658 659 660 661 662 663 664 665

  // name and link name of memory
  repeated MemoryConfig memories = 8;

  // if use recurrent layer group, all layers in submodel will postfix by
  // "_in_"+submodel.name, so we add a name pair to link between
  // root model and layer group,
  // note that these in/out layers are not input/output of the network.
  repeated LinkConfig in_links = 9;
  repeated LinkConfig out_links = 10;

  optional GeneratorConfig generator = 11;
666

L
liaogang 已提交
667 668
  // the id of inlink which share info with outlinks, used in recurrent layer
  // group
669
  optional int32 target_inlinkid = 12;
Z
zhangjinchao01 已提交
670 671 672 673 674
}

message ModelConfig {
  // type of the model.
  // Currently, "nn", "recurrent_nn" and "recursive_nn" are supported
L
liaogang 已提交
675
  required string type = 1 [ default = "nn" ];
Z
zhangjinchao01 已提交
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698

  // layers should be ordered in such a way that the forward propagation
  // can be correctly executed by going from the first layer to the last layer
  repeated LayerConfig layers = 2;

  repeated ParameterConfig parameters = 3;

  // Input layers should have the same order as the data streams provided
  // by the data provider. The type of input layers should be "data"
  repeated string input_layer_names = 4;

  // For training, the type of a output layer is usually cost layer.
  // For prediction, they should be the actual output layers.
  repeated string output_layer_names = 5;

  repeated EvaluatorConfig evaluators = 6;

  repeated SubModelConfig sub_models = 8;

  // For External Machine, defining how to split a neural network
  // into multiple parts.
  optional ExternalConfig external_config = 9;
};