66import shutil
77import yaml
88import platform
9+ from tensorflow .python .platform import gfile
910from neural_compressor .adaptor .tf_utils .util import disable_random
1011from neural_compressor .experimental import Quantization , Benchmark , common
1112from neural_compressor .adaptor .tf_utils .util import version1_lt_version2 , version1_gte_version2
@@ -239,6 +240,9 @@ def test_itex_benchmark_gpu(self):
239240 relu = tf .nn .relu (add )
240241 relu6 = tf .nn .relu6 (relu , name = 'op_to_store' )
241242 out_name = relu6 .name .split (':' )[0 ]
243+ num_of_instance = 1
244+ cores_per_instance = 1
245+ log_file = ''
242246 with tf .compat .v1 .Session () as sess :
243247 sess .run (tf .compat .v1 .global_variables_initializer ())
244248 output_graph_def = graph_util .convert_variables_to_constants (
@@ -257,11 +261,13 @@ def test_itex_benchmark_gpu(self):
257261 evaluator .b_dataloader = common .DataLoader (dataset )
258262 num_of_instance = evaluator .conf .usr_cfg .evaluation .performance .configs .num_of_instance
259263 cores_per_instance = evaluator .conf .usr_cfg .evaluation .performance .configs .cores_per_instance
264+ log_file = '{}_{}_{}.log' .format (num_of_instance , cores_per_instance , 0 )
265+ if gfile .Exists (log_file ):
266+ os .remove (log_file )
260267 evaluator .model = output_graph
261268 evaluator ('performance' )
262269
263270 found_multi_instance_log = False
264- log_file = '{}_{}_{}.log' .format (num_of_instance , cores_per_instance , 0 )
265271 for file_name in os .listdir (os .getcwd ()):
266272 if file_name == log_file :
267273 found_multi_instance_log = True
0 commit comments