From 76ff51c68e7c1a895dba00391363287d3f20be05 Mon Sep 17 00:00:00 2001 From: Wenyu Date: Fri, 3 Feb 2023 18:51:27 +0800 Subject: [PATCH] fix drop_prob type for paddle develop (#7681) --- 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