API(create_tensor) error message enhancement (#23571)

revert-23830-2.0-beta
wangchaochaohu 5 years ago committed by GitHub
parent b465bb0de7
commit f39899a43d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

Loading…
Cancel
Save