未验证 提交 76ff51c6 编写于 作者: W Wenyu 提交者: GitHub

fix drop_prob type for paddle develop (#7681)

上级 b2e0acf1
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册