From b19807f852b337e61d20e53ac1fa5e0bc88464b7 Mon Sep 17 00:00:00 2001 From: shangliang Xu Date: Tue, 14 Sep 2021 15:56:15 +0800 Subject: [PATCH] [fp16] fix bug when use drop block in fp16 (#4178) --- ppdet/modeling/layers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppdet/modeling/layers.py b/ppdet/modeling/layers.py index 713880b9a..117637745 100644 --- a/ppdet/modeling/layers.py +++ b/ppdet/modeling/layers.py @@ -279,7 +279,7 @@ class DropBlock(nn.Layer): for s in shape: gamma *= s / (s - self.block_size + 1) - matrix = paddle.cast(paddle.rand(x.shape, x.dtype) < gamma, x.dtype) + matrix = paddle.cast(paddle.rand(x.shape) < gamma, x.dtype) mask_inv = F.max_pool2d( matrix, self.block_size, -- GitLab