From e23e51ff2b0d722b7463c08fca9a8f3d93e27469 Mon Sep 17 00:00:00 2001 From: Wenyu Date: Fri, 3 Feb 2023 18:52:04 +0800 Subject: [PATCH] fix drop_prob type (#7682) --- ppdet/modeling/backbones/transformer_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ppdet/modeling/backbones/transformer_utils.py b/ppdet/modeling/backbones/transformer_utils.py index bc10652d5..46d7b9f28 100644 --- a/ppdet/modeling/backbones/transformer_utils.py +++ b/ppdet/modeling/backbones/transformer_utils.py @@ -32,7 +32,7 @@ def drop_path(x, drop_prob=0., training=False): """ if drop_prob == 0. or not training: return x - keep_prob = paddle.to_tensor(1 - drop_prob) + keep_prob = paddle.to_tensor(1 - drop_prob, dtype=x.dtype) shape = (paddle.shape(x)[0], ) + (1, ) * (x.ndim - 1) random_tensor = keep_prob + paddle.rand(shape, dtype=x.dtype) random_tensor = paddle.floor(random_tensor) # binarize -- GitLab