From 8a2dd34a1e7623bf7bd59872ba2b4e3c2322feec Mon Sep 17 00:00:00 2001 From: LielinJiang <50691816+LielinJiang@users.noreply.github.com> Date: Tue, 1 Dec 2020 12:52:47 +0800 Subject: [PATCH] fix depthwise conv (#29227) --- python/paddle/nn/layer/conv.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/paddle/nn/layer/conv.py b/python/paddle/nn/layer/conv.py index 1c971c024a9..279f0648db1 100644 --- a/python/paddle/nn/layer/conv.py +++ b/python/paddle/nn/layer/conv.py @@ -143,9 +143,10 @@ class _ConvNd(layers.Layer): cudnn_version is not None) else False self._op_type = "conv" + str(dims) + 'd' - if dims == 2 and (in_channels == groups and in_channels != 1 and - out_channels % in_channels == 0): - self.op_type = 'depthwise_conv2d' + if self._op_type == 'conv2d' and (in_channels == groups and + in_channels != 1 and + out_channels % in_channels == 0): + self._op_type = 'depthwise_conv2d' self._use_cudnn = False -- GitLab