Skip to content

【Hackathon 5th No.32】为 Paddle 新增 tensor_split / hsplit / dsplit API -- v2.0 #776

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 8, 2023

Conversation

megemini
Copy link
Contributor

@megemini megemini commented Dec 7, 2023

PR types

Others

PR changes

Others

Description

修改 hsplit, vsplit, dsplit 通过 tensor_split 实现。

主要修改部分为 # 五、设计思路与实现方案

参考 rfc:https://github.com/PaddlePaddle/community/blob/master/rfcs/APIs/20231003_api_design_for_tensor_split.md

@zoooo0820 @jeff41404

请评审 ~ 谢谢!

@@ -518,25 +522,27 @@ dsplit = tf_export.tf_export('experimental.numpy.dsplit', v1=[])(
- `TensorFlow`, `Numpy` 的实现方式:`split`, `vsplit`, `dsplit`, `hsplit` 为一组,都是通过 `split` (indices_or_sections) 实现,`Numpy` 单独实现了 `array_split` 函数 (indices_or_sections)。
- `Paddle` 的实现方式:`split`, `vsplit` 为一组,都是通过 `split` (num_or_sections) 实现。
Copy link
Contributor

Choose a reason for hiding this comment

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

此处以及第四章也修改一下吧

注明下方案中对vsplit做了不兼容修改


其中:

- `num_or_sections`, `split_size_or_sections` 数量或分片长度
- `int` 表示拆分数量
- `list` 表示每个分片长度

- `indices_or_sections` 数量或切分索引位置
- `num_or_indices`, `indices_or_sections` 数量或切分索引位置
- `int` 表示拆分数量
- `list` 表示切分的索引位置

Copy link
Contributor

Choose a reason for hiding this comment

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

这个地方,可以结合前面描述的int / 数组的语义,解释下为什么命名为num_or_indices 而不直接复用pytorch/ numpy的参数命名

@megemini
Copy link
Contributor Author

megemini commented Dec 8, 2023

Update 20231208

  • 修改第四章,总结对比
  • 修改第五章,不兼容修改

请评审 ~

Copy link
Contributor

@zoooo0820 zoooo0820 left a comment

Choose a reason for hiding this comment

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

LGTM

@zoooo0820 zoooo0820 merged commit 8dfef44 into PaddlePaddle:master Dec 8, 2023
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.

3 participants