Skip to content

Commit 74dca27

Browse files
committed
enable mkldnn benchmark with googlenet
1 parent bce1c03 commit 74dca27

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

benchmark/paddle/image/googlenet.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
width = 224
66
num_class = 1000
77
batch_size = get_config_arg('batch_size', int, 128)
8+
use_gpu = get_config_arg('use_gpu', bool, True)
89

910
args = {'height': height, 'width': width, 'color': True, 'num_class': num_class}
1011
define_py_data_sources2(
@@ -16,6 +17,8 @@
1617
learning_method=MomentumOptimizer(0.9),
1718
regularization=L2Regularization(0.0005 * batch_size))
1819

20+
conv_projection = conv_projection if use_gpu else img_conv_layer
21+
1922
def inception2(name, input, channels, \
2023
filter1,
2124
filter3R, filter3,
@@ -138,7 +141,7 @@ def inception(name, input, channels, \
138141
cat = concat_layer(
139142
name=name,
140143
input=[cov1, cov3, cov5, covprj],
141-
bias_attr=True,
144+
bias_attr=True if use_gpu else False,
142145
act=ReluActivation())
143146
return cat
144147

benchmark/paddle/image/run_mkldnn.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ fi
4040
for use_mkldnn in True False; do
4141
for batchsize in 64 128 256; do
4242
train vgg 19 $batchsize $use_mkldnn
43-
train resnet 50 $batchsize $use_mkldnn
43+
train resnet 50 $batchsize $use_mkldnn
44+
train googlenet v1 $batchsize $use_mkldnn
4445
done
4546
done

0 commit comments

Comments
 (0)