From fc0497bd33a7bfd1fc95eff4464918afca0e263f Mon Sep 17 00:00:00 2001 From: Li-fAngyU <56572498+Li-fAngyU@users.noreply.github.com> Date: Tue, 14 Mar 2023 11:54:25 +0800 Subject: [PATCH] update empty api to support complex dtype at static mode (#51377) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update empty api to support compex dtype at static mode * code style * code style * 补充注释里的类型描述 --- python/paddle/tensor/creation.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/python/paddle/tensor/creation.py b/python/paddle/tensor/creation.py index ff74b4bc944..9b69d30340b 100644 --- a/python/paddle/tensor/creation.py +++ b/python/paddle/tensor/creation.py @@ -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 an Tensor, it should be an 1-D Tensor which represents a list. 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`` for details). 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): check_dtype( dtype, 'dtype', - ['bool', 'float16', 'float32', 'float64', 'int32', 'int64'], + [ + 'bool', + 'float16', + 'float32', + 'float64', + 'int32', + 'int64', + 'complex64', + 'complex128', + ], 'empty', ) check_type(shape, 'shape', (Variable, list, tuple), 'empty') -- GitLab