@@ -321,8 +321,6 @@ def TensorflowEmit(original_framework, architecture_name, architecture_path, wei
321321 import tensorflow as tf
322322 from mmdnn .conversion .tensorflow .tensorflow_emitter import TensorflowEmitter
323323
324- original_framework = checkfrozen (original_framework )
325-
326324 # IR to code
327325 converted_file = original_framework + '_tensorflow_' + architecture_name + "_converted"
328326 converted_file = converted_file .replace ('.' , '_' )
@@ -337,6 +335,7 @@ def TensorflowEmit(original_framework, architecture_name, architecture_path, wei
337335 model_converted = __import__ (converted_file ).KitModel (weight_path )
338336 input_tf , model_tf = model_converted
339337
338+ original_framework = checkfrozen (original_framework )
340339 func = TestKit .preprocess_func [original_framework ][architecture_name ]
341340 img = func (image_path )
342341 input_data = np .expand_dims (img , 0 )
@@ -408,11 +407,8 @@ def KerasEmit(original_framework, architecture_name, architecture_path, weight_p
408407
409408 # import converted model
410409 model_converted = __import__ (converted_file ).KitModel (weight_path )
411-
412-
413410 func = TestKit .preprocess_func [original_framework ][architecture_name ]
414411
415-
416412 img = func (image_path )
417413 input_data = np .expand_dims (img , 0 )
418414
@@ -648,8 +644,9 @@ def OnnxEmit(original_framework, architecture_name, architecture_path, weight_pa
648644 except ImportError :
649645 return None
650646
651- os .remove (converted_file + '.py' )
652- os .remove (converted_file + '.npy' )
647+ finally :
648+ os .remove (converted_file + '.py' )
649+ os .remove (converted_file + '.npy' )
653650
654651
655652 exception_tabel = {
0 commit comments