@@ -23,14 +23,14 @@ class PriorBoxOp : public framework::OperatorWithKernel {
23
23
24
24
void InferShape (framework::InferShapeContext* ctx) const override {
25
25
PADDLE_ENFORCE (ctx->HasInput (" Input" ),
26
- " Input(X ) of PriorBoxOp should not be null." );
26
+ " Input(Input ) of PriorBoxOp should not be null." );
27
27
PADDLE_ENFORCE (ctx->HasInput (" Image" ),
28
- " Input(Offset ) of PriorBoxOp should not be null." );
28
+ " Input(Image ) of PriorBoxOp should not be null." );
29
29
30
30
auto image_dims = ctx->GetInputDim (" Image" );
31
31
auto input_dims = ctx->GetInputDim (" Input" );
32
- PADDLE_ENFORCE (image_dims.size () == 4 , " The format of image is NCHW." );
33
- PADDLE_ENFORCE (input_dims.size () == 4 , " The format of input is NCHW." );
32
+ PADDLE_ENFORCE (image_dims.size () == 4 , " The layout of image is NCHW." );
33
+ PADDLE_ENFORCE (input_dims.size () == 4 , " The layout of input is NCHW." );
34
34
35
35
PADDLE_ENFORCE_LT (input_dims[2 ], image_dims[2 ],
36
36
" The height of input must smaller than image." );
@@ -45,7 +45,7 @@ class PriorBoxOp : public framework::OperatorWithKernel {
45
45
bool flip = ctx->Attrs ().Get <bool >(" flip" );
46
46
47
47
PADDLE_ENFORCE_GT (min_sizes.size (), 0 ,
48
- " Size of min_size must be at least 1." );
48
+ " Size of min_sizes must be at least 1." );
49
49
for (size_t i = 0 ; i < min_sizes.size (); ++i) {
50
50
PADDLE_ENFORCE_GT (min_sizes[i], 0 , " min_sizes[%d] must be positive." , i);
51
51
}
@@ -56,7 +56,7 @@ class PriorBoxOp : public framework::OperatorWithKernel {
56
56
int num_priors = aspect_ratios_vec.size () * min_sizes.size ();
57
57
if (max_sizes.size () > 0 ) {
58
58
PADDLE_ENFORCE_EQ (max_sizes.size (), min_sizes.size (),
59
- " The length of min_size and max_size must be equal." );
59
+ " The number of min_size and max_size must be equal." );
60
60
for (size_t i = 0 ; i < min_sizes.size (); ++i) {
61
61
PADDLE_ENFORCE_GT (max_sizes[i], min_sizes[i],
62
62
" max_size[%d] must be greater than min_size[%d]." , i,
@@ -65,13 +65,10 @@ class PriorBoxOp : public framework::OperatorWithKernel {
65
65
}
66
66
}
67
67
68
- if (variances.size () > 1 ) {
69
- PADDLE_ENFORCE_EQ (variances.size (), 4 ,
70
- " Must and only provide 4 variance." );
71
- for (size_t i = 0 ; i < variances.size (); ++i) {
72
- PADDLE_ENFORCE_GT (variances[i], 0.0 ,
73
- " variance[%d] must be greater than 0." , i);
74
- }
68
+ PADDLE_ENFORCE_EQ (variances.size (), 4 , " Must and only provide 4 variance." );
69
+ for (size_t i = 0 ; i < variances.size (); ++i) {
70
+ PADDLE_ENFORCE_GT (variances[i], 0.0 ,
71
+ " variance[%d] must be greater than 0." , i);
75
72
}
76
73
77
74
const float step_h = ctx->Attrs ().Get <float >(" step_h" );
@@ -95,19 +92,19 @@ class PriorBoxOpMaker : public framework::OpProtoAndCheckerMaker {
95
92
: OpProtoAndCheckerMaker(proto, op_checker) {
96
93
AddInput (" Input" ,
97
94
" (Tensor, default Tensor<float>), "
98
- " the input feature data of PriorBoxOp, The format is NCHW." );
95
+ " the input feature data of PriorBoxOp, The layout is NCHW." );
99
96
AddInput (" Image" ,
100
97
" (Tensor, default Tensor<float>), "
101
- " the input image data of PriorBoxOp, The format is NCHW." );
98
+ " the input image data of PriorBoxOp, The layout is NCHW." );
102
99
AddOutput (" Boxes" ,
103
100
" (Tensor, default Tensor<float>), the output prior boxes of "
104
- " PriorBoxOp. The format is [layer_height, layer_width, "
101
+ " PriorBoxOp. The layout is [layer_height, layer_width, "
105
102
" num_priors, 4]. layer_height is the height of input, "
106
103
" layer_width is the width of input, num_priors is the box "
107
104
" count of each position." );
108
105
AddOutput (" Variances" ,
109
106
" (Tensor, default Tensor<float>), the expanded variances of "
110
- " PriorBoxOp. The format is [layer_height, layer_width, "
107
+ " PriorBoxOp. The layout is [layer_height, layer_width, "
111
108
" num_priors, 4]. layer_height is the height of input, "
112
109
" layer_width is the width of input, num_priors is the box "
113
110
" count of each position." );
@@ -117,12 +114,10 @@ class PriorBoxOpMaker : public framework::OpProtoAndCheckerMaker {
117
114
" List of max sizes of generated prior boxes." );
118
115
AddAttr<std::vector<float >>(
119
116
" aspect_ratios" , " (vector<float>) " ,
120
- " List of aspect ratios of generated prior boxes." )
121
- .SetDefault ({});
117
+ " List of aspect ratios of generated prior boxes." );
122
118
AddAttr<std::vector<float >>(
123
119
" variances" , " (vector<float>) " ,
124
- " List of variances to be encoded in prior boxes." )
125
- .SetDefault ({0.1 });
120
+ " List of variances to be encoded in prior boxes." );
126
121
AddAttr<bool >(" flip" , " (bool) " , " Whether to flip aspect ratios." )
127
122
.SetDefault (true );
128
123
AddAttr<bool >(" clip" , " (bool) " , " Whether to clip out-of-boundary boxes." )
0 commit comments