@@ -192,6 +192,9 @@ def check_output_with_place(self, place):
192
192
self .op .run (self .scope , ctx )
193
193
194
194
for out_name , out_dup in Operator .get_op_outputs (self .op .type ()):
195
+ if out_name not in self .outputs :
196
+ continue
197
+
195
198
if out_dup :
196
199
sub_out = self .outputs [out_name ]
197
200
if not isinstance (sub_out , list ):
@@ -206,14 +209,12 @@ def check_output_with_place(self, place):
206
209
actual , expect , atol = 1e-05 ),
207
210
"output name: " + out_name + " has diff" )
208
211
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" )
217
218
218
219
def check_output (self ):
219
220
places = [core .CPUPlace ()]
0 commit comments