File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -69,9 +69,9 @@ static void Interpolate1DInferShapeCheck(framework::InferShapeContext* ctx) {
6969 " Scale's shape must be 1, but got shape = %d ." , scale_tensor[0 ]));
7070 // out_w = -1;
7171 } else {
72- if (ctx->HasInput (" scale" )) {
72+ auto scale = ctx->Attrs ().Get <std::vector<float >>(" scale" );
73+ if (scale.size () > 0 ) {
7374 float scale_w = -1 ;
74- auto scale = ctx->Attrs ().Get <std::vector<float >>(" scale" );
7575 scale_w = scale[0 ];
7676 PADDLE_ENFORCE_EQ (scale_w > 0 , true , platform::errors::InvalidArgument (
7777 " scale of Op(interpolate) "
@@ -162,10 +162,10 @@ static void Interpolate2DInferShapeCheck(framework::InferShapeContext* ctx) {
162162 // out_h = -1;
163163 // out_w = -1;
164164 } else {
165- if (ctx->HasInput (" scale" )) {
165+ auto scale = ctx->Attrs ().Get <std::vector<float >>(" scale" );
166+ if (scale.size () > 0 ) {
166167 float scale_h = -1 ;
167168 float scale_w = -1 ;
168- auto scale = ctx->Attrs ().Get <std::vector<float >>(" scale" );
169169 scale_h = scale[0 ];
170170 scale_w = scale[1 ];
171171 PADDLE_ENFORCE_EQ (
@@ -268,11 +268,11 @@ static void Interpolate3DInferShapeCheck(framework::InferShapeContext* ctx) {
268268 // out_h = -1;
269269 // out_w = -1;
270270 } else {
271- if (ctx->HasInput (" scale" )) {
271+ auto scale = ctx->Attrs ().Get <std::vector<float >>(" scale" );
272+ if (scale.size () > 0 ) {
272273 float scale_d = -1 ;
273274 float scale_h = -1 ;
274275 float scale_w = -1 ;
275- auto scale = ctx->Attrs ().Get <std::vector<float >>(" scale" );
276276 scale_d = scale[0 ];
277277 scale_h = scale[1 ];
278278 scale_w = scale[2 ];
You can’t perform that action at this time.
0 commit comments