Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Docathon][Add API Legend No.15]+Add api_legend image #6990

Closed
wants to merge 2 commits into from

Conversation

UfanLee
Copy link

@UfanLee UfanLee commented Nov 20, 2024

.. _cn_api_paddle_atleast_1d:

atleast_1d
.. py:function:: paddle.atleast_1d(*inputs, name=None)

该函数将输入转换为张量并确保返回的张量至少为 1 维。如果输入是标量,则会被转换为 1 维张量;如果输入是 1 维或更高维的张量,则会被保留原样。此函数非常有用,特别是在需要确保输入的维度符合要求时。

下面的图例展示了 paddle.atleast_1d 函数如何处理不同维度的输入,以确保输出至少为一维。

.. figure:: ../../images/api_legend/atleast_1d.png
:width: 500
:alt: Illustration of paddle.atleast_1d Function Operations
:align: center

参数 ::::::::::::

inputs (Tensor|list(Tensor)) - 一个或多个输入的 Tensor,支持的输入数据类型包括:float16、float32、float64、int16、int32、int64、int8、uint8、complex64、complex128、bfloat16 或 bool。
name (str,可选) - 用于指定操作名称,具体用法请参见 :ref:api_guide_Name,通常无需设置,默认值为 None。
返回 ::::::::::::

返回值是一个 Tensor 或一个包含 Tensor 的 list。如果只有一个输入,则返回一个 Tensor;如果有多个输入,则返回一个由 Tensor 组成的 list。

代码示例 ::::::::::::

COPY-FROM: paddle.atleast_1d

Copy link

paddle-bot bot commented Nov 20, 2024

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6990.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@CLAassistant
Copy link

CLAassistant commented Nov 20, 2024

CLA assistant check
All committers have signed the CLA.

@luotao1
Copy link
Collaborator

luotao1 commented Nov 27, 2024

评论区的内容要提交到对应的文件里

@luotao1 luotao1 closed this Dec 23, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
contributor HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants