From 8cc91bc02552c0ef5d5773463d4566e5a6e3d3db Mon Sep 17 00:00:00 2001 From: Kexin Zhao Date: Thu, 3 May 2018 17:41:14 -0700 Subject: [PATCH] initial commit (#10387) --- python/paddle/fluid/layer_helper.py | 4 ++-- python/paddle/fluid/layers/nn.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/layer_helper.py b/python/paddle/fluid/layer_helper.py index 62933b5125..86efd1ff51 100644 --- a/python/paddle/fluid/layer_helper.py +++ b/python/paddle/fluid/layer_helper.py @@ -400,11 +400,11 @@ class LayerHelper(object): if isinstance(act, basestring): act = {'type': act} + if 'use_cudnn' in self.kwargs and self.kwargs.get('use_cudnn'): + act['use_cudnn'] = self.kwargs.get('use_cudnn') if 'use_mkldnn' in self.kwargs: act['use_mkldnn'] = self.kwargs.get('use_mkldnn') act_type = act.pop('type') - if 'use_mkldnn' in self.kwargs: - act['use_mkldnn'] = self.kwargs.get('use_mkldnn') tmp = input_var # NOTE(dzhwinter): some activation support inplace compution. if not core.IsInplace(act_type): diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 93e8d0bf29..1786be22fd 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -88,6 +88,7 @@ def fc(input, num_flatten_dims=1, param_attr=None, bias_attr=None, + use_cudnn=False, use_mkldnn=False, act=None, is_test=False, -- GitLab