未验证 提交 f39899a4 编写于 作者: W wangchaochaohu 提交者: GitHub

API(create_tensor) error message enhancement (#23571)

上级 b465bb0d
......@@ -57,6 +57,10 @@ def create_tensor(dtype, name=None, persistable=False):
import paddle.fluid as fluid
tensor = fluid.layers.create_tensor(dtype='float32')
"""
check_dtype(dtype, 'dtype', [
'bool', 'float16', 'float32', 'float64', 'int8', 'int32', 'int32',
'int64'
], 'create_tensor')
helper = LayerHelper("create_tensor", **locals())
return helper.create_variable(
name=helper.name, dtype=dtype, persistable=persistable)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册