未验证 提交 fc0497bd 编写于 作者: L Li-fAngyU 提交者: GitHub

update empty api to support complex dtype at static mode (#51377)

* update empty api to support compex dtype at static mode

* code style

* code style

* 补充注释里的类型描述
上级 2d0e8c3b
...@@ -1734,7 +1734,7 @@ def empty(shape, dtype=None, name=None): ...@@ -1734,7 +1734,7 @@ def empty(shape, dtype=None, name=None):
If ``shape`` is a list or tuple, each element of it should be integer or 0-D Tensor with shape []. If ``shape`` is a list or tuple, each element of it should be integer or 0-D Tensor with shape [].
If ``shape`` is an Tensor, it should be an 1-D Tensor which represents a list. If ``shape`` is an Tensor, it should be an 1-D Tensor which represents a list.
dtype(np.dtype|str, optional): Data type of the output Tensor dtype(np.dtype|str, optional): Data type of the output Tensor
which can be bool, float16, float32, float64, int32, int64, if dytpe is `None`, the data which can be bool, float16, float32, float64, int32, int64, complex64, complex128 if dytpe is `None`, the data
type of created Tensor use global default dtype (see ``get_default_dtype`` type of created Tensor use global default dtype (see ``get_default_dtype``
for details). for details).
name(str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None. name(str, optional): For details, please refer to :ref:`api_guide_Name`. Generally, no setting is required. Default: None.
...@@ -1787,7 +1787,16 @@ def empty(shape, dtype=None, name=None): ...@@ -1787,7 +1787,16 @@ def empty(shape, dtype=None, name=None):
check_dtype( check_dtype(
dtype, dtype,
'dtype', 'dtype',
['bool', 'float16', 'float32', 'float64', 'int32', 'int64'], [
'bool',
'float16',
'float32',
'float64',
'int32',
'int64',
'complex64',
'complex128',
],
'empty', 'empty',
) )
check_type(shape, 'shape', (Variable, list, tuple), 'empty') check_type(shape, 'shape', (Variable, list, tuple), 'empty')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册