未验证 提交 34bf8dfc 编写于 作者: Z Zhang Ting 提交者: GitHub

avoid calling cast twice (#30527)

上级 bdae7ed3
......@@ -228,6 +228,7 @@ def cast(x, dtype):
if not isinstance(dtype, core.VarDesc.VarType):
dtype = convert_np_dtype_to_dtype_(dtype)
out = core.ops.cast(x, 'in_dtype', x.dtype, 'out_dtype', dtype)
return out
check_variable_and_dtype(
x, 'x',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册