-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
为 paddle.linalg.norm 进行功能升级与对齐- 添加 vector_norm #61155
Conversation
python/paddle/tensor/linalg.py
Outdated
>>> print(out_vector_norm) | ||
Tensor(shape=[2], dtype=float32, place=Place(gpu:0), stop_gradient=True, | ||
[12., 11.]) | ||
>>> out_vector_norm = paddle.vector_norm(x=x,p=1,axis=1,keepdim=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x, porder=p, axis=axis, keepdim=keepdim, name=name | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原来的那个内部函数vector_norm也一起删掉吧,这个相当于暴露了之前的内部函数vector_norm,可以覆盖其功能
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前猜测的问题是 当p=0 && len(axis) >= 2时得到结果的数据类型与input数据类型不一致。 |
本地复现不出来么 |
找到问题了,np.inf的原因,已更正。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doctoring 格式需要规范化一下
Calculate the p-order vector norm for certain dimension of Tensor `input`. | ||
Returns the vector norm (the 1-norm, the Euclidean or 2-norm, and in general the p-norm) | ||
of a given tensor. | ||
Args: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Args: | |
Args: |
keepdim (bool, optional): Whether keep the dimensions as the `input`, Default False. | ||
name (str, optional): The default value is None. Normally there is no need for | ||
user to set this property. For more information, please refer to :ref:`api_guide_Name`. | ||
Returns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns: | |
Returns: |
Examples: | ||
.. code-block:: python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Examples: | |
.. code-block:: python | |
Examples: | |
.. code-block:: python | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
doc-preview的ci挂了,好像是因为你分支behind develop太多,先豁免合入~建议明天去官网develop文档看看效果,有没有错误
remind @zbt78 |
好滴,明白是那里的问题了。 |
你的PR提交成功,感谢你对开源项目的贡献! |
PR types
Function optimization
PR changes
APIs
Description
暴露内部函数vector_norm为
paddle.linalg.vector_norm