2525
2626import paddle
2727from paddle import _C_ops
28+ from paddle .utils import deprecated
2829from paddle .utils .decorator_utils import ParamAliasDecorator , SizeArgsDecorator
2930from paddle .utils .inplace_utils import inplace_apis_in_dygraph_only
3031
@@ -1543,8 +1544,8 @@ def zeros_like(
15431544
15441545
15451546def eye (
1546- num_rows : int ,
1547- num_columns : int | None = None ,
1547+ num_rows : int | paddle . Tensor ,
1548+ num_columns : int | paddle . Tensor | None = None ,
15481549 dtype : DTypeLike | None = None ,
15491550 name : str | None = None ,
15501551 * ,
@@ -1557,8 +1558,8 @@ def eye(
15571558 This function constructs 2-D Tensor with ones on the diagonal and zeros elsewhere.
15581559
15591560 Args:
1560- num_rows(int): the number of rows in each batch Tensor.
1561- num_columns(int| None, optional): the number of columns in each batch Tensor.
1561+ num_rows(int | paddle.Tensor ): the number of rows in each batch Tensor.
1562+ num_columns(int | paddle.Tensor | None, optional): the number of columns in each batch Tensor.
15621563 If None, default: num_rows.
15631564 dtype(np.dtype|str, optional): The data type of the returned Tensor.
15641565 It should be int32, int64, float16, float32, float64, complex64, complex128. Default: if None, the data type
@@ -1953,6 +1954,12 @@ def arange(
19531954 return out
19541955
19551956
1957+ @deprecated (
1958+ reason = (
1959+ "paddle.range is deprecated and will be removed in a future release because its behavior is inconsistent with Python's range builtin."
1960+ "Instead, use paddle.arange, which produces values in [start, end)"
1961+ )
1962+ )
19561963def range (
19571964 start : float | paddle .Tensor = 0 ,
19581965 end : float | paddle .Tensor | None = None ,
@@ -2829,6 +2836,7 @@ def diag(
28292836 return out
28302837
28312838
2839+ @SizeArgsDecorator ()
28322840def empty (
28332841 shape : ShapeLike ,
28342842 dtype : DTypeLike | None = None ,
0 commit comments