From 4f2cf7fbcaca52bb9625dc6be944f552ea1d71d5 Mon Sep 17 00:00:00 2001 From: xiaoxiaohehe001 <49090790+xiaoxiaohehe001@users.noreply.github.com> Date: Wed, 9 Aug 2023 17:05:31 +0800 Subject: [PATCH] [Paddle Inference] Set softmax op use_cudnn default true. (#56036) * fix_softmax_eigen * fix_ctest_seresnet * fix_ci_error --- paddle/phi/api/yaml/op_compat.yaml | 2 +- test/legacy_test/dist_se_resnext.py | 2 +- test/legacy_test/seresnext_net.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/paddle/phi/api/yaml/op_compat.yaml b/paddle/phi/api/yaml/op_compat.yaml index 97b3641abd9..d9c4bd1fbaf 100755 --- a/paddle/phi/api/yaml/op_compat.yaml +++ b/paddle/phi/api/yaml/op_compat.yaml @@ -2528,7 +2528,7 @@ softmax : GetSoftmaxExpectedKernelType softmax_grad : GetSoftmaxGradExpectedKernelType extra : - attrs : [str data_format = "AnyLayout", bool use_cudnn=false, bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] + attrs : [str data_format = "AnyLayout", bool use_cudnn = true, bool use_mkldnn = false, str mkldnn_data_type = "float32", bool is_test = false] - op : softplus backward : softplus_grad, softplus_double_grad diff --git a/test/legacy_test/dist_se_resnext.py b/test/legacy_test/dist_se_resnext.py index 4609be2a5e2..ddc79809e80 100644 --- a/test/legacy_test/dist_se_resnext.py +++ b/test/legacy_test/dist_se_resnext.py @@ -218,7 +218,7 @@ class DistSeResneXt2x2(TestDistRunnerBase): model = SE_ResNeXt(layers=50) out = model.net(input=image, class_dim=102) cost = paddle.nn.functional.cross_entropy( - input=out, label=label, reduction='none', use_softmax=False + input=out, label=label, reduction='none', use_softmax=True ) avg_cost = paddle.mean(x=cost) diff --git a/test/legacy_test/seresnext_net.py b/test/legacy_test/seresnext_net.py index 5ef504bc404..1cfda9d1d50 100644 --- a/test/legacy_test/seresnext_net.py +++ b/test/legacy_test/seresnext_net.py @@ -171,7 +171,7 @@ def SE_ResNeXt50Small(use_feed): # Classifier layer: prediction = paddle.static.nn.fc(x=dropout, size=1000, activation='softmax') loss = paddle.nn.functional.cross_entropy( - input=prediction, label=label, reduction='none', use_softmax=False + input=prediction, label=label, reduction='none', use_softmax=True ) loss = paddle.mean(loss) return loss -- GitLab