-
Notifications
You must be signed in to change notification settings - Fork 874
Correct api difference format #7617
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
Correct api difference format #7617
Conversation
|
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7617.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
📚 本次 PR 文档预览链接(点击展开)
|
| | PyTorch | PaddlePaddle | 备注 | | ||
| | ------- | ------------ | ------------------------------------------------------------------------------------------ | | ||
| | optimizer | - | torch.optim.Optimizer 类,Paddle 无此参数。 | | ||
| | factor | values | PyTorch 表示乘以学习率的因子,Paddle 表示学习率列表。需要转写,转写思路为:values=[factor*optimizer.lr, optimizer.lr]。 | |
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.
这里的 需要转写 不用去掉
|
|
||
| ### 转写示例 | ||
| #### A 参数转写 | ||
| #### Pytorch A 参数和 Paddle y 参数 |
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.
这里标注 torch 的待转写参数即可
| ### 转写示例 | ||
| #### size_average | ||
| size_average 为 True | ||
| #### size_averagesize_average 为 True |
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.
这里改的格式不对,下面有size_average 为 True、size_average 为 False
|
|
||
| #### reduce | ||
| reduce 为 True | ||
| #### reducereduce 为 True |
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.
这里改的格式不对,下面有reduce为True,reduce为False
|
|
||
| #### reduction | ||
| reduction 为'none' | ||
| #### reductionreduction 为'none' |
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.
同上
|
|
||
| | PyTorch | PaddlePaddle | 备注 | | ||
| | ---------- | ------------ | -- | | ||
| | closure | - | 传入一个闭包函数,在优化器更新参数前执行。Paddle 无此参数,暂无转写方式。| |
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.
这个应该是torch参数更多,删除原因是?
| | lstrip | lstrip | 是否移除左侧空白符。 | | ||
| | rstrip | rstrip | 是否移除左侧空白符。 | | ||
| | special | - | 是否有特殊的处理方式,Paddle 暂不支持该参数. | | ||
| | special | - | 是否有特殊的处理方式,Paddle 暂不支持该参数.。 | |
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.
多了一个 .
| ### [torch.nn.Module.train](https://pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module.train) | ||
|
|
||
| ```python | ||
| torch.nn.Module.train(mode=True) |
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.
这个目前也是torch参数,不应该删除?
| @@ -0,0 +1,138 @@ | |||
| import json | |||
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.
validate_api_difference与validate_api_difference_format两者的区别是?前者是一致性校验工具吗
| @@ -0,0 +1,138 @@ | |||
| import json | |||
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.
如果没问题了,这两个工具可以推到CI上了。
validate_pytorch_api_mapping与validate_api_difference,排除url检查。
zhwesky2010
left a comment
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.
- size_average/reduce这些统一成一个写法,目前没有统一,统一按CrossEntropyLoss的写法来。
2.工具是否可以优化下,打印输出并给出返回码。这样ci脚本里不用写太多逻辑,直接判断返回码就行。
ci_scripts/hooks/pre-doc-compile.sh
Outdated
| LAST_LINE=$(echo "$VALIDATION_OUTPUT" | tail -n 1) | ||
|
|
||
| # Check if last line matches error string | ||
| if [ "$LAST_LINE" = "VALIDATE PYTORCH_API_MAPPING ERROR!" ]; then |
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.
这个情况返回码不为1吗
ci_scripts/hooks/pre-doc-compile.sh
Outdated
|
|
||
| echo "INFO: Validating PyTorch API mapping with --skip-url-check" | ||
| VALIDATE_CMD="python ${APIMAPPING_ROOT}/tools/validate_pytorch_api_mapping.py --skip-url-check" | ||
| VALIDATION_OUTPUT=$(eval "$VALIDATE_CMD" 2>&1) |
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.
cmd直接写进来就可以
No description provided.