@@ -192,6 +192,9 @@ def check_output_with_place(self, place):
192192 self .op .run (self .scope , ctx )
193193
194194 for out_name , out_dup in Operator .get_op_outputs (self .op .type ()):
195+ if out_name not in self .outputs :
196+ continue
197+
195198 if out_dup :
196199 sub_out = self .outputs [out_name ]
197200 if not isinstance (sub_out , list ):
@@ -206,14 +209,12 @@ def check_output_with_place(self, place):
206209 actual , expect , atol = 1e-05 ),
207210 "output name: " + out_name + " has diff" )
208211 else :
209- var = self .scope .find_var (out_name )
210- if var is not None :
211- actual = np .array (var .get_tensor ())
212- expect = self .outputs [out_name ]
213- self .assertTrue (
214- np .allclose (
215- actual , expect , atol = 1e-05 ),
216- "output name: " + out_name + " has diff" )
212+ actual = np .array (self .scope .find_var (out_name ).get_tensor ())
213+ expect = self .outputs [out_name ]
214+ self .assertTrue (
215+ np .allclose (
216+ actual , expect , atol = 1e-05 ),
217+ "output name: " + out_name + " has diff" )
217218
218219 def check_output (self ):
219220 places = [core .CPUPlace ()]
0 commit comments