File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,6 @@ void ConvOp::InferShape(framework::InferShapeContext* ctx) const {
31
31
std::vector<int > paddings = ctx->Attrs ().Get <std::vector<int >>(" paddings" );
32
32
int groups = ctx->Attrs ().Get <int >(" groups" );
33
33
std::vector<int > dilations = ctx->Attrs ().Get <std::vector<int >>(" dilations" );
34
- int input_channels = in_dims[1 ];
35
- int output_channels = filter_dims[0 ];
36
34
37
35
PADDLE_ENFORCE (in_dims.size () == 4 || in_dims.size () == 5 ,
38
36
" Conv intput should be 4-D or 5-D tensor." );
@@ -45,9 +43,13 @@ void ConvOp::InferShape(framework::InferShapeContext* ctx) const {
45
43
PADDLE_ENFORCE_EQ (
46
44
paddings.size (), strides.size (),
47
45
" Conv paddings dimension and Conv strides dimension should be the same." );
46
+
47
+ int input_channels = in_dims[1 ];
48
48
PADDLE_ENFORCE_EQ (input_channels, filter_dims[1 ] * groups,
49
49
" The number of input channels should be equal to filter "
50
50
" channels * groups." );
51
+
52
+ int output_channels = filter_dims[0 ];
51
53
PADDLE_ENFORCE_EQ (
52
54
output_channels % groups, 0 ,
53
55
" The number of output channels should be divided by groups." );
You can’t perform that action at this time.
0 commit comments