Skip to content

Commit 7f0f15a

Browse files
committed
update check dtype
1 parent 10a917b commit 7f0f15a

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

python/paddle/tensor/creation.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3351,25 +3351,25 @@ def set_(
33513351
raise ValueError(
33523352
f"Input (source) should be paddle.Tensor but received {type(source)}"
33533353
)
3354-
if source.dtype not in [
3355-
paddle.bool,
3356-
paddle.float16,
3357-
paddle.bfloat16,
3358-
paddle.float32,
3359-
paddle.float64,
3360-
paddle.int8,
3361-
paddle.int16,
3362-
paddle.int32,
3363-
paddle.int64,
3364-
paddle.uint8,
3365-
paddle.complex64,
3366-
paddle.complex128,
3367-
]:
3368-
raise ValueError(
3369-
"dtype of Input (source) must be any of [bool, float16, bfloat16, float32, "
3370-
"float64, int8, int16, int32, int64, uint8, complex64, complex128, bfloat16], "
3371-
f"but received {source.dtype}"
3372-
)
3354+
check_dtype(
3355+
source.dtype,
3356+
'source',
3357+
[
3358+
'bool',
3359+
'float16',
3360+
'uint16',
3361+
'float32',
3362+
'float64',
3363+
'int8',
3364+
'int16',
3365+
'int32',
3366+
'int64',
3367+
'uint8',
3368+
'complex64',
3369+
'complex128',
3370+
],
3371+
'set',
3372+
)
33733373
if stride is None:
33743374
if shape is None:
33753375
stride = source.strides

0 commit comments

Comments
 (0)