From 0a79499c8d0f0725dc4258808b7bb5af0364d430 Mon Sep 17 00:00:00 2001 From: Guoxia Wang Date: Wed, 22 Dec 2021 12:07:35 +0800 Subject: [PATCH] fix prelu weight shape for NHWC of static mode (#38310) --- python/paddle/fluid/layers/nn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index c7fb75387aa..1f8593a1f36 100755 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -9864,7 +9864,7 @@ def prelu(x, mode, param_attr=None, data_format="NCHW", name=None): #NOTE(zhiqiu): Revert shape to [1, channel, 1, 1] for compatibility with saved model of old version. #NOTE(GuoxiaWang): support NHWC data format if data_format == 'NHWC': - alpha_shape = [1, 1, 1, x.shape[1]] + alpha_shape = [1, 1, 1, x.shape[-1]] else: alpha_shape = [1, x.shape[1], 1, 1] -- GitLab