Skip to content

Commit 118b765

Browse files
authored
Merge pull request #15763 from guomingz/resolve_issue_15724_v1.3
[cherry-pick] [V1.3] resolve #15724
2 parents 4550862 + c0d2342 commit 118b765

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

python/paddle/fluid/contrib/int8_inference/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ Notes:
6363
## 4. How to reproduce the results
6464
* Small dataset
6565
```bash
66-
python python/paddle/fluid/contrib/tests/test_calibration.py
66+
FLAGS_use_mkldnn=true python python/paddle/fluid/contrib/tests/test_calibration.py
6767
```
6868

6969
* Full dataset
7070
```bash
71-
DATASET=full python python/paddle/fluid/contrib/tests/test_calibration.py
71+
FLAGS_use_mkldnn=true DATASET=full python python/paddle/fluid/contrib/tests/test_calibration.py
7272
```

python/paddle/fluid/contrib/tests/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ if(APPLE OR WIN32 OR NOT WITH_MKL)
66
endif()
77

88
foreach(src ${TEST_OPS})
9-
py_test(${src} SRCS ${src}.py)
9+
if(src MATCHES "test_calibration")
10+
py_test(${src} SRCS ${src}.py ENVS FLAGS_use_mkldnn=true)
11+
else()
12+
py_test(${src} SRCS ${src}.py)
13+
endif()
1014
endforeach()

python/paddle/fluid/contrib/tests/test_calibration.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ def download_model(self):
199199

200200
def run_program(self, model_path, generate_int8=False, algo='direct'):
201201
image_shape = [3, 224, 224]
202-
os.environ['FLAGS_use_mkldnn'] = 'True'
203202

204203
fluid.memory_optimize(fluid.default_main_program())
205204

@@ -241,9 +240,6 @@ def run_program(self, model_path, generate_int8=False, algo='direct'):
241240
label = label.reshape([-1, 1])
242241
running_program = calibrator.sampling_program.clone(
243242
) if generate_int8 else infer_program.clone()
244-
for op in running_program.current_block().ops:
245-
if op.has_attr("use_mkldnn"):
246-
op._set_attr("use_mkldnn", True)
247243

248244
t1 = time.time()
249245
_, acc1, _ = exe.run(

0 commit comments

Comments
 (0)