diff --git a/python/paddle/tensor/manipulation.py b/python/paddle/tensor/manipulation.py index c288242e1a314..73429bc373801 100644 --- a/python/paddle/tensor/manipulation.py +++ b/python/paddle/tensor/manipulation.py @@ -4553,6 +4553,13 @@ def expand_as(x: Tensor, y: Tensor, name: str | None = None) -> Tensor: Both the number of dimensions of ``x`` and ``y`` must be less than or equal to 6, and the number of dimensions of ``y`` must be greater than or equal to that of ``x``. The dimension to expand must have a value of 0. + The following diagram illustrates how a one-dimensional tensor is transformed into a tensor with a shape of [2,3] through the expand_as operation. The target tensor has a shape of [2,3], and through expand_as, the one-dimensional tensor is expanded into a tensor with a shape of [2,3]. + + .. image:: https://githubraw.cdn.bcebos.com/PaddlePaddle/docs/develop/docs/images/api_legend/expand_as.png + :width: 800 + :alt: expand_as API + :align: center + Args: x (Tensor): The input tensor, its data type is bool, float32, float64, int32 or int64. y (Tensor): The input tensor that gives the shape to expand to.