2
2
import os
3
3
import sys
4
4
from utils import *
5
+ import mlc
6
+ import importlib
5
7
6
8
7
9
def preprocess (i ):
@@ -17,7 +19,9 @@ def preprocess(i):
17
19
adr = i ['input' ].get ('adr' )
18
20
19
21
automation = i ['automation' ]
20
- mlc = i ['automation' ].action_object
22
+ # mlc = i['automation'].action_object
23
+ # cache_action = i['automation'].cache_action
24
+ cache_action = mlc
21
25
22
26
quiet = (env .get ('MLC_QUIET' , False ) == 'yes' )
23
27
verbose = (env .get ('MLC_VERBOSE' , False ) == 'yes' )
@@ -61,7 +65,7 @@ def preprocess(i):
61
65
models ['mobilenet' ]['v3' ] = models_all ['mobilenet' ]['v3' ]
62
66
elif is_true (env .get ('MLC_MLPERF_RUN_MOBILENETS' , '' )):
63
67
models ['mobilenet' ] = models_all ['mobilenet' ]
64
- elif is_true (env .get ('MLC_MLPERF_RUN_EFFICIENTNETS' , '' )):
68
+ if is_true (env .get ('MLC_MLPERF_RUN_EFFICIENTNETS' , '' )):
65
69
models ['efficientnet' ] = models_all ['efficientnet' ]
66
70
67
71
variation_strings = {}
@@ -107,17 +111,17 @@ def preprocess(i):
107
111
execution_mode = "test"
108
112
109
113
precisions = []
110
- if env .get ('MLC_MLPERF_RUN_FP32' , '' ) == "yes" :
114
+ if is_true ( env .get ('MLC_MLPERF_RUN_FP32' , '' )) :
111
115
precisions .append ("fp32" )
112
- if env .get ('MLC_MLPERF_RUN_INT8' , '' ) == "yes" :
116
+ if is_true ( env .get ('MLC_MLPERF_RUN_INT8' , '' )) :
113
117
precisions .append ("uint8" )
114
118
115
119
implementation_tags = []
116
- if env .get ('MLC_MLPERF_USE_ARMNN_LIBRARY' , '' ) == "yes" :
120
+ if is_true ( env .get ('MLC_MLPERF_USE_ARMNN_LIBRARY' , '' )) :
117
121
implementation_tags .append ("_armnn" )
118
- if env .get ('MLC_MLPERF_TFLITE_ARMNN_NEON' , '' ) == "yes" :
122
+ if is_true ( env .get ('MLC_MLPERF_TFLITE_ARMNN_NEON' , '' )) :
119
123
implementation_tags .append ("_use-neon" )
120
- if env .get ('MLC_MLPERF_TFLITE_ARMNN_OPENCL' , '' ) == "yes" :
124
+ if is_true ( env .get ('MLC_MLPERF_TFLITE_ARMNN_OPENCL' , '' )) :
121
125
implementation_tags .append ("_use-opencl" )
122
126
implementation_tags_string = "," .join (implementation_tags )
123
127
@@ -185,34 +189,27 @@ def preprocess(i):
185
189
if is_true (env .get ('MLC_MLPERF_POWER' , '' )):
186
190
mlc_input ['power' ] = 'yes'
187
191
188
- if is_true (env .get ('MLC_MLPERF_ACCURACY_MODE' , '' )):
189
- mlc_input ['mode' ] = 'accuracy'
190
- print (mlc_input )
191
- r = mlc .access (mlc_input )
192
- if r ['return' ] > 0 :
193
- return r
194
-
195
- if is_true (env .get ('MLC_MLPERF_PERFORMANCE_MODE' , '' )):
196
- mlc_input ['mode' ] = 'performance'
197
-
198
- print (mlc_input )
199
- r = mlc .access (mlc_input )
200
- if r ['return' ] > 0 :
201
- return r
202
-
203
- if env .get ('MLC_TEST_ONE_RUN' , '' ) == "yes" :
204
- return {'return' : 0 }
192
+ print (mlc_input )
193
+ r = mlc .access (mlc_input )
194
+ if r ['return' ] > 0 :
195
+ return r
196
+ importlib .reload (mlc .action )
205
197
206
198
if is_true (env .get ('MLC_MINIMIZE_DISK_SPACE' , '' )):
207
- r = mlc .access (clean_input )
199
+ r = cache_action .access (clean_input )
208
200
if r ['return' ] > 0 :
209
201
print (r )
210
202
# return r
211
203
212
- r = mlc .access (clean_input )
204
+ if is_true (env .get ('MLC_TEST_ONE_RUN' , '' )):
205
+ return {'return' : 0 }
206
+
207
+ r = cache_action .access (clean_input )
213
208
if r ['return' ] > 0 :
214
209
print (r )
215
210
# return r
211
+ else :
212
+ importlib .reload (mlc .action )
216
213
return {'return' : 0 }
217
214
218
215
0 commit comments