From 025feb6de9a450b3dc31e7e38cd2c2212c39b5db Mon Sep 17 00:00:00 2001 From: gaotingquan Date: Wed, 15 Dec 2021 12:46:18 +0000 Subject: [PATCH] fix: fix -1 in dims --- ppcls/arch/backbone/model_zoo/pvt_v2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ppcls/arch/backbone/model_zoo/pvt_v2.py b/ppcls/arch/backbone/model_zoo/pvt_v2.py index 94175754..f435e875 100644 --- a/ppcls/arch/backbone/model_zoo/pvt_v2.py +++ b/ppcls/arch/backbone/model_zoo/pvt_v2.py @@ -147,7 +147,8 @@ class Attention(nn.Layer): ]).transpose([2, 0, 3, 1, 4]) else: x_ = x.transpose([0, 2, 1]).reshape([B, C, H, W]) - x_ = self.sr(self.pool(x_)).reshape([B, C, -1]).transpose( + x_ = self.sr(self.pool(x_)) + x_ = x_.reshape([B, C, x_.shape[2] * x_.shape[3]]).transpose( [0, 2, 1]) x_ = self.norm(x_) x_ = self.act(x_) -- GitLab