Skip to content

Conversation

ADream-ki
Copy link
Contributor

No description provided.

Copy link

paddle-bot bot commented Mar 31, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请检查PR提交格式和内容是否完备,具体请参考示例模版
Your PR has been submitted. Thanks for your contribution!
Please check its format and content. For this, you can refer to Template and Demo.

@CLAassistant
Copy link

CLAassistant commented Mar 31, 2024

CLA assistant check
All committers have signed the CLA.

[ -79.54292 24.00183 -41.34253 ]]
"""

ormqr_ = _get_cache_prim(Ormqr)(left, transpose)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的Ormqr是一个class吗,能看到Mindspore在哪里定义的吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以的,我已经提上来了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

具体实现,也已经在写了,大概明天就可以了

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lxd-cumt 您好,这里需要您再review一下

Copy link

@lxd-cumt lxd-cumt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

| 提交时间 `<input type="checkbox" class="rowselector hidden">` | 2024-03-27 |
| 版本号 | V2.0 |
| 依赖飞桨版本 `<input type="checkbox" class="rowselector hidden">` | develop |
| 文件名 | 20240326_api_design_for_ormqr.md `<br>` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image 表格有乱码,请处理下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已处理


- 实现方式不同

PyTorch 通过 c++ 实现;MindSpore 通过 python 实现。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image 此处格式可以调整下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已调整


# 五、设计思路与实现方案

paddle 目前的算子已经支持矩阵的转置,行列计算等操作,因此,可以使用 paddle 已有算子实现 `ormqr` ,由于要求输入 `input` 与 `othrt` 具有相同的 `ndim`,因此,不需要使用 `decrease_axes` 等参数。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • othrt这个参数从哪里来的?上文中也没有
  • decrease_axes 等参数从哪儿来的?上文中也没有

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应为other,已修改
decrease_axes应是调整维度的参数,但此处并不需要,因此已删除


## PyTorch

PyTorch 中有 API `torch.ormqr(input, tau, other, left=True, transpose=False, *, out=None) → Tensoor` 以及对应的 `torch.Tensor.ormqr`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tensoor-》Tensor

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

- input: (Tensor) shape(\*,mn,k),当 left 为 True 时, mn 的值等于 m,否则 mn 的值等于 n。 \*表示 Tensor 在轴 0 上的长度为 0 或者大于 0。
- tau: (Tensor) shape(\*,min(mn,k)),其中 \_ 表示 Tensor 在轴 0 上的长度为 0 或者大于 0,其类型与 input 相同。
- other: (Tensor) shape(\*,m,n),其中 \* 表示 Tensor 在轴 0 上的长度为 0 或者大于 0,其类型与 input 相同。
- left: (bool, 可选) 决定了矩阵乘积运算的顺序。如果 left 为 True ,计算顺序为 op(Q) x other ,否则,计算顺序为 other x op(Q)。默认值:True。
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

op(Q) x other,中间的x是乘号还是字母x

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是乘号

# 附件及参考资料

[【Hackathon 6th No.4】为 Paddle 新增 ormqr API](https://github.com/PaddlePaddle/community/pull/668)
[PyTorch slice_scatter 文档](https://pytorch.org/docs/stable/generated/torch.slice_scatter.html)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

371和372行需要有段落符号

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已添加

# 六、测试和验收的考量

- GPU 测试场景
- 支持各种 Tensor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 只有GPU测试场景,没有CPU的么?
  2. 需要写清楚支持哪些数据类型
  3. 需要写清楚:计算正确性怎么验证,是和numpy对比,还是其他方案?
  4. 多维:能支持到几维?
  5. 静态图和动态图都需要支持

Copy link
Contributor Author

@ADream-ki ADream-ki Apr 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已提交修改,并提交adaptivelogsoftmaxwithloss rfc
#854

- 支持 CPU、GPU 测试场景
- 支持动态图以及静态图
- 支持各种 Tensor,如:float32, float64, complex64, complex128
- 通过对比 mindspore 框架中的 ormqr 算子输出,计算结果是否一致
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

支持各种 Tensor,如:float32, float64, complex64, complex128

@lxd-cumt 再review下这块的数据类型,能支持复数么?以及是否要支持其他数据类型。

通过对比 mindspore 框架中的 ormqr 算子输出,计算结果是否一致

这个单侧里没法实现吧,飞桨单侧框架里也不会 import mindspore

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我是本地需要的摘出来跑的。精度上paddlepaddle会比mindspore上高

@ADream-ki
Copy link
Contributor Author

ADream-ki commented Apr 8, 2024

由于操作失误,#855#856 为新的pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants