Skip to content

Conversation

RedContritio
Copy link
Contributor

  • 修复了此前类构造方法签名不一致的问题:均不使用 class
  • 新增了部分映射文档,基于 PaConvert 已实现的 api 映射

剩余已实现的 api 文档正在整理中

思考:
考虑维护问题的话,或许可以考虑给所有的映射文档一个更统一规范的模板?
包括但不限于:
- 映射文档中函数签名不同行的缩进与空格使用等
- 网址格式是否使用锚点
- 参数对比表格格式中字体强调色、表格空格使用数量、表格分割线格式等
- 同级别的映射类型同时存在时,映射类型选择与映射类型描述的规范等(如,参数名不一致 + paddle 参数更多)

Copy link
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

注意内容详细得当,这个文档的核心是 突出torch->paddle的差异,其他无差异的地方应省尽省

@RedContritio RedContritio force-pushed the add_classes branch 2 times, most recently from 607124c to adef7f6 Compare February 5, 2024 14:53
@zhwesky2010
Copy link
Collaborator

  • 修复了此前类构造方法签名不一致的问题:均不使用 class
  • 新增了部分映射文档,基于 PaConvert 已实现的 api 映射

剩余已实现的 api 文档正在整理中

思考:
考虑维护问题的话,或许可以考虑给所有的映射文档一个更统一规范的模板?
包括但不限于:

  • 映射文档中函数签名不同行的缩进与空格使用等
  • 网址格式是否使用锚点
  • 参数对比表格格式中字体强调色、表格空格使用数量、表格分割线格式等
  • 同级别的映射类型同时存在时,映射类型选择与映射类型描述的规范等(如,参数名不一致 + paddle 参数更多)

后面可以考虑进一步规范,但是历史存量修改问题会比较多

| mat1 | x | 表示输入的 Tensor,仅参数名不一致。 |
| mat2 | y | 表示输入的 Tensor,仅参数名不一致。 |
| beta | beta | 乘以 input 的标量。|
| alpha | alpha | 乘以 x*y 的标量。|
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个是乘以x还是乘以y?

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.addmmout=alpha∗x∗y+beta∗input,乘以 x*y

### [paddle.Tensor.matmul](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor_cn.html#matmul-y-transpose-x-false-transpose-y-false-name-none)

```python
paddle.Tensor.matmul(y, transpose_x=False, transpose_y=False, name=None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

关于:参数名不一致 + paddle参数更多 多种类型的后面确实可以整体考虑优化下,目前按规范写的是 仅paddle参数更多

| dataset | dataset | 所用的数据集。 |
| num_replicas | num_replicas | 进程数量。 |
| rank | rank | num_replicas 个进程中的进程序号。 |
| shuffle | shuffle | 是否打乱。PyTorch 默认值为 True, 默认值为 False。Paddle 需设置为与 PyTorch 一致。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

paddle默认值为False

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 | PaddlePaddle | 备注 |
| ------- | ------------ | ------------------ |
| dim | axis | 指定对输入 Tensor 进行运算的轴,仅参数名不一致。 |
| keepdim | keepdim | 是否在输出 Tensor 中保留减小的维度。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

paddle的dtype没写,下个PR补上

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | ------------------ |
| dim | axis | 指定对输入 Tensor 进行运算的轴,仅参数名不一致。 |
| keepdim | keepdim | 是否在输出 Tensor 中保留减小的维度。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

paddle的dtype没写,下个PR补上

| PyTorch | PaddlePaddle | 备注 |
| ------- | ------------ | -- |
| dim | axis | 指定对 x 进行计算的轴,仅参数名不一致。 |
| keepdim | keepdim | 是否在输出 Tensor 中保留减小的维度,PyTorch 默认值为 False,Paddle 默认值为 True。Paddle 需设置为与 PyTorch 一致。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个我记得修改过来了,下个PR改

Copy link
Contributor Author

Choose a reason for hiding this comment

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

确实,已经改过来了,只是在 官网页面 上仍然没改。

@@ -1,29 +1,37 @@
## [ 参数不一致 ]torch.utils.data.distributed.DistributedSampler
## [ torch 参数更多 ]torch.utils.data.distributed.DistributedSampler
Copy link
Collaborator

Choose a reason for hiding this comment

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

torch多的seed可直接删除,这样是不是就不用算torch参数更多,可以看下其他的这样情况是怎么处理的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个有不同的写法,如 #5989torch.utils.data.WeightedRandomSampler 作为参数一致处理,而 #6285torch.utils.data.SubsetRandomSampler 作为 torch 参数更多 处理,考虑到后者更新且都属于 Sampler,因此作为参数更多处理先。

@zhwesky2010 zhwesky2010 merged commit 0fef3b3 into PaddlePaddle:develop Feb 18, 2024
@RedContritio RedContritio deleted the add_classes branch February 19, 2024 01:16
)
paddle_pattern = re.compile(
r"^### +\[ *(?P<paddle_api>paddle.[^\]]+)\]\((?P<url>[^\)]+)$"
r"^### +\[ *(?P<paddle_api>paddle.[^\]]+)\](?P<url>\([^\)]*\))?$"
Copy link
Member

Choose a reason for hiding this comment

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

@RedContritio

为什么 () 被包含在了 group url 里?这样提取的 url 全部包含 (),最后生成的链接也是错的

image image

Copy link
Member

Choose a reason for hiding this comment

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

已在 #6522 修复

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