未验证 提交 b19807f8 编写于 作者: S shangliang Xu 提交者: GitHub

[fp16] fix bug when use drop block in fp16 (#4178)

上级 df522565
...@@ -279,7 +279,7 @@ class DropBlock(nn.Layer): ...@@ -279,7 +279,7 @@ class DropBlock(nn.Layer):
for s in shape: for s in shape:
gamma *= s / (s - self.block_size + 1) 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( mask_inv = F.max_pool2d(
matrix, matrix,
self.block_size, self.block_size,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册