@@ -159,6 +159,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
159159 if (op_type == " relu" || op_type == " relu6" || op_type == " tanh" ||
160160 op_type == " sigmoid" ) {
161161 auto * block = desc.Block ();
162+ if (block == nullptr ) {
163+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
164+ " Developers need to check whether block_desc is passed in "
165+ " the pass." ;
166+ return false ;
167+ }
162168 auto x_var_name = desc.Input (" X" )[0 ];
163169 auto * x_var_desc = block->FindVar (x_var_name);
164170 const auto x_shape = x_var_desc->GetShape ();
@@ -274,6 +280,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
274280
275281 if (op_type == " matmul" ) {
276282 auto * block = desc.Block ();
283+ if (block == nullptr ) {
284+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
285+ " Developers need to check whether block_desc is passed in "
286+ " the pass." ;
287+ return false ;
288+ }
277289 for (auto & param_name : desc.Inputs ()) {
278290 for (auto & var_name : param_name.second ) {
279291 auto * var_desc = block->FindVar (var_name);
@@ -324,6 +336,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
324336 if (axis[0 ] == 0 && axis.size () == 2 ) return false ;
325337
326338 auto * block = desc.Block ();
339+ if (block == nullptr ) {
340+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
341+ " Developers need to check whether block_desc is passed in "
342+ " the pass." ;
343+ return false ;
344+ }
327345 auto x_var_name = desc.Input (" X" )[0 ];
328346 auto * x_var_desc = block->FindVar (x_var_name);
329347 const auto x_shape = x_var_desc->GetShape ();
@@ -372,6 +390,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
372390 return false ;
373391 } else {
374392 auto * block = desc.Block ();
393+ if (block == nullptr ) {
394+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
395+ " Developers need to check whether block_desc is passed in "
396+ " the pass." ;
397+ return false ;
398+ }
375399 auto * x_var_desc = block->FindVar (desc.Input (" X" )[0 ]);
376400 const auto x_shape = x_var_desc->GetShape ();
377401 if (x_shape.size () == 1 ) {
@@ -385,6 +409,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
385409 if (!with_dynamic_shape) return false ;
386410
387411 auto * block = desc.Block ();
412+ if (block == nullptr ) {
413+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
414+ " Developers need to check whether block_desc is passed in "
415+ " the pass." ;
416+ return false ;
417+ }
388418 auto x_var_name = desc.Input (" X" )[0 ];
389419 auto index_var_name = desc.Input (" Index" )[0 ];
390420 auto * x_var_desc = block->FindVar (x_var_name);
@@ -428,6 +458,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
428458 if (data_layout != framework::DataLayout::kNCHW ) return false ;
429459
430460 auto * block = desc.Block ();
461+ if (block == nullptr ) {
462+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
463+ " Developers need to check whether block_desc is passed in "
464+ " the pass." ;
465+ return false ;
466+ }
431467 auto x_var_name = desc.Input (" X" )[0 ];
432468 auto * x_var_desc = block->FindVar (x_var_name);
433469 const auto x_shape = x_var_desc->GetShape ();
@@ -439,6 +475,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
439475 if (op_type == " multiclass_nms" ) {
440476 if (with_dynamic_shape) return false ;
441477 auto * block = desc.Block ();
478+ if (block == nullptr ) {
479+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
480+ " Developers need to check whether block_desc is passed in "
481+ " the pass." ;
482+ return false ;
483+ }
442484 for (auto & param_name : desc.Inputs ()) {
443485 for (auto & var_name : param_name.second ) {
444486 auto * var_desc = block->FindVar (var_name);
@@ -598,6 +640,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
598640 return false ;
599641 }
600642 auto * block = desc.Block ();
643+ if (block == nullptr ) {
644+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
645+ " Developers need to check whether block_desc is passed in "
646+ " the pass." ;
647+ return false ;
648+ }
601649 auto x_var_name = desc.Input (" X" )[0 ];
602650 auto * x_var_desc = block->FindVar (x_var_name);
603651 const auto x_shape = x_var_desc->GetShape ();
@@ -657,6 +705,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
657705 }
658706 }
659707 auto * block = desc.Block ();
708+ if (block == nullptr ) {
709+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
710+ " Developers need to check whether block_desc is passed in "
711+ " the pass." ;
712+ return false ;
713+ }
660714 auto x_var_name = desc.Input (" X" )[0 ];
661715 auto * x_var_desc = block->FindVar (x_var_name);
662716 const auto x_shape = x_var_desc->GetShape ();
@@ -724,6 +778,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
724778 return false ;
725779 }
726780 auto * block = desc.Block ();
781+ if (block == nullptr ) {
782+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
783+ " Developers need to check whether block_desc is passed in "
784+ " the pass." ;
785+ return false ;
786+ }
727787 auto * x_var_desc = block->FindVar (desc.Input (" X" )[0 ]);
728788 auto * y_var_desc = block->FindVar (desc.Input (" Y" )[0 ]);
729789 const auto x_shape = x_var_desc->GetShape ();
@@ -775,6 +835,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
775835 }
776836
777837 auto * block = desc.Block ();
838+ if (block == nullptr ) {
839+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
840+ " Developers need to check whether block_desc is passed in "
841+ " the pass." ;
842+ return false ;
843+ }
778844 auto x_var_name = desc.Input (" X" )[0 ];
779845 auto * x_var_desc = block->FindVar (x_var_name);
780846 const auto x_shape = x_var_desc->GetShape ();
@@ -856,6 +922,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
856922 }
857923 std::vector<int64_t > shape;
858924 auto * block = desc.Block ();
925+ if (block == nullptr ) {
926+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
927+ " Developers need to check whether block_desc is passed in "
928+ " the pass." ;
929+ return false ;
930+ }
859931 for (auto & param_name : desc.Inputs ()) {
860932 for (auto & var_name : param_name.second ) {
861933 auto * var_desc = block->FindVar (var_name);
@@ -881,6 +953,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
881953
882954 if (op_type == " scale" ) {
883955 auto * block = desc.Block ();
956+ if (block == nullptr ) {
957+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
958+ " Developers need to check whether block_desc is passed in "
959+ " the pass." ;
960+ return false ;
961+ }
884962 auto x_var_name = desc.Input (" X" )[0 ];
885963 auto * x_var_desc = block->FindVar (x_var_name);
886964 const auto x_shape = x_var_desc->GetShape ();
@@ -892,6 +970,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
892970
893971 if (op_type == " swish" ) {
894972 auto * block = desc.Block ();
973+ if (block == nullptr ) {
974+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
975+ " Developers need to check whether block_desc is passed in "
976+ " the pass." ;
977+ return false ;
978+ }
895979 auto x_var_name = desc.Input (" X" )[0 ];
896980 auto * x_var_desc = block->FindVar (x_var_name);
897981 const auto x_shape = x_var_desc->GetShape ();
@@ -916,6 +1000,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
9161000 }
9171001
9181002 auto * block = desc.Block ();
1003+ if (block == nullptr ) {
1004+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
1005+ " Developers need to check whether block_desc is passed in "
1006+ " the pass." ;
1007+ return false ;
1008+ }
9191009 auto * var_desc = block->FindVar (desc.Input (" Alpha" )[0 ]);
9201010 if (!var_desc) {
9211011 VLOG (3 ) << " Variable Alpha of prelu TRT converter not found." ;
@@ -1051,6 +1141,12 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
10511141 }
10521142
10531143 auto * block = desc.Block ();
1144+ if (block == nullptr ) {
1145+ VLOG (3 ) << " The block desc is nullptr, we can't continue to analyze. "
1146+ " Developers need to check whether block_desc is passed in "
1147+ " the pass." ;
1148+ return false ;
1149+ }
10541150 auto x_var_name = desc.Input (" X" )[0 ];
10551151 auto * x_var_desc = block->FindVar (x_var_name);
10561152 const auto x_shape = x_var_desc->GetShape ();
0 commit comments