-
Notifications
You must be signed in to change notification settings - Fork 871
[Docs] 更新第二类api_difference差异文档 #7576
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
[Docs] 更新第二类api_difference差异文档 #7576
Conversation
|
感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-7576.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html |
📚 本次 PR 文档预览链接(点击展开)
|
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.functional.logsigmoid.md这个是 仅参数名不同
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.
有几个普遍问题,没有一一标注,需要自行整体检查下:
- 如果Tensor类方法签名生成时,需要去掉第一个参数。第一个参数相当于是class 的 self
- 转写示例 pytorch与paddle间空一行
| ### [paddle.Tensor.nonzero](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor/nonzero_cn.html#paddle/Tensor/nonzero_cn#cn-api-paddle-Tensor-nonzero) | ||
|
|
||
| ```python | ||
| paddle.Tensor.nonzero(x, as_tuple=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
| ### [torch.Tensor.bernoulli](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.bernoulli) | ||
|
|
||
| ```python | ||
| torch.Tensor.bernoulli(*, generator=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.
没有*
| ### [paddle.Tensor.clip_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor/clip__cn.html#paddle/Tensor/clip__cn#cn-api-paddle-Tensor-clip_) | ||
|
|
||
| ```python | ||
| paddle.Tensor.clip_(x, min=None, max=None, name=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.
没有x
| ### [paddle.Tensor.conj](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor/conj_cn.html#paddle/Tensor/conj_cn#cn-api-paddle-Tensor-conj) | ||
|
|
||
| ```python | ||
| paddle.Tensor.conj(x, name=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.
没有x
|
|
||
| ```python | ||
| # PyTorch 写法 | ||
| result = src.device |
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.
空一行
| ### [paddle.Tensor.multigammaln_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor/multigammaln__cn.html#paddle/Tensor/multigammaln__cn#cn-api-paddle-Tensor-multigammaln_) | ||
|
|
||
| ```python | ||
| paddle.Tensor.multigammaln_(x, p, name=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.
没有x
| ### [paddle.Tensor.neg](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor/neg_cn.html#paddle/Tensor/neg_cn#cn-api-paddle-Tensor-neg) | ||
|
|
||
| ```python | ||
| paddle.Tensor.neg(x, name=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.
没有x
| ### [paddle.Tensor.neg_](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor/neg__cn.html#paddle/Tensor/neg__cn#cn-api-paddle-Tensor-neg_) | ||
|
|
||
| ```python | ||
| paddle.Tensor.neg_(x, name=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.
没有x
|
|
||
| ```python | ||
| # PyTorch 写法 | ||
| result = x.positive() |
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.
空行
| ### [paddle.Tensor.real](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor/real_cn.html#paddle/Tensor/real_cn#cn-api-paddle-Tensor-real) | ||
|
|
||
| ```python | ||
| paddle.Tensor.real(x, name=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.
没有x
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.
| return grad | ||
|
|
||
| # Paddle 写法 | ||
| class cus_tanh(paddle.autograd.Function): |
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.
这个是paddle.autograd.PyLayer
| return grad_x | ||
|
|
||
| # Paddle 写法 | ||
| class cus_func(paddle.autograd.Function): |
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.
paddle.autograd.PyLayer
| return grad_input | ||
|
|
||
| # Paddle 写法 | ||
| class MyFunction(paddle.autograd.Function): |
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.
paddle.autograd.PyLayer
| return grad | ||
|
|
||
| # Paddle 写法 | ||
| class cus_tanh(paddle.autograd.Function): |
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.
paddle.autograd.PyLayer
| return grad | ||
|
|
||
| # Paddle 写法 | ||
| class cus_tanh(paddle.autograd.Function): |
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.
paddle.autograd.PyLayer
|
|
||
| ```python | ||
| torch.numel(input) | ||
| torch.numel() |
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.
签名不对
|
|
||
| ```python | ||
| # PyTorch 写法 | ||
| optim = torch.optim.Optimizer([theta], defaults={"learning_rate": 1.0}) |
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.
这个初始一个SGD的实例,然后调用sgd.step吧
https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/optimizer/SGD_cn.html#sgd
| ### [paddle.io.Dataset](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/io/Dataset_cn.html#paddle/io/Dataset_cn#cn-api-paddle-io-Dataset) | ||
|
|
||
| ```python | ||
| paddle.io.Dataset() |
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.
签名没有任何参数吗,查查代码
| ### [paddle.io.IterableDataset](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/io/IterableDataset_cn.html#paddle/io/IterableDataset_cn#cn-api-paddle-io-IterableDataset) | ||
|
|
||
| ```python | ||
| paddle.io.IterableDataset() |
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.
签名?
| (0.1, 0.1), | ||
| (0.5, 1.5), | ||
| 20, | ||
| torchvision.transforms.InterpolationMode.BILINEAR, |
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.
这个例子不对,paddle代码里还有torch的api。
上面的例子是经过paconvert转的吗,要确保不是错误的转写示例
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.
默认参数这一块应该还有不少错误,这个没有一一标注,需要自行确认下。
如果不是默认参数,在转写示例里按道理都是应该有输入的。
| ### [paddle.Tensor.pinv](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/Tensor/pinv_cn.html#paddle/Tensor/pinv_cn#cn-api-paddle-Tensor-pinv) | ||
|
|
||
| ```python | ||
| paddle.Tensor.pinv(x, rcond=1e-15, hermitian=False, name=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.
这个没有x
| return grad | ||
|
|
||
| # Paddle 写法 | ||
| class cus_tanh(paddle.autograd.PyLayer: |
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.
语法有问题
|
|
||
| ```python | ||
| # PyTorch 写法 | ||
| result = torch.backends.cudnn.version() == torch.backends.cudnn.version() |
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.
这个示例写简单点
| ### [paddle.framework.core.nvprof_nvtx_pop](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/framework/core/nvprof_nvtx_pop_cn.html#paddle/framework/core/nvprof_nvtx_pop_cn#cn-api-paddle-framework-core-nvprof_nvtx_pop) | ||
|
|
||
| ```python | ||
| paddle.framework.core.nvprof_nvtx_pop() |
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.
目前框架修改了,之前是paddle.framework.core,目前也有 paddle.core了。
那这一块就统一用最短的路径吧,paconvert后面也修改下
| result = torch.cuda.nvtx.range_pop() | ||
|
|
||
| # Paddle 写法 | ||
| result = paddle.framework.core.nvprof_nvtx_pop() |
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.
paddle.framework.core系列的统一改成 paddle.core
| ### [paddle.vision.transforms.RandomCrop](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/RandomCrop_cn.html#paddle/vision/transforms/RandomCrop_cn#cn-api-paddle-vision-transforms-RandomCrop) | ||
|
|
||
| ```python | ||
| paddle.vision.transforms.RandomCrop(size, padding, pad_if_needed, fill, padding_mode, keys) |
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.
keys是否默认参数?
| ### [paddle.vision.transforms.RandomRotation](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/RandomRotation_cn.html#paddle/vision/transforms/RandomRotation_cn#cn-api-paddle-vision-transforms-RandomRotation) | ||
|
|
||
| ```python | ||
| paddle.vision.transforms.RandomRotation(degrees, interpolation, expand, center, fill, keys) |
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.
keys是否默认参数?
| ### [paddle.vision.transforms.ToTensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/ToTensor_cn.html#paddle/vision/transforms/ToTensor_cn#cn-api-paddle-vision-transforms-ToTensor) | ||
|
|
||
| ```python | ||
| paddle.vision.transforms.ToTensor(data_format, keys) |
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.
keys是否默认参数?
| ### [torchvision.transforms.functional.affine](https://pytorch.org/vision/stable/generated/torchvision.transforms.functional.affine.html#torchvision.transforms.functional.affine) | ||
|
|
||
| ```python | ||
| torchvision.transforms.functional.affine(img, angle, translate, scale, shear, interpolation, fill, center) |
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.
后面是否默认参数
| ### [paddle.vision.transforms.to_tensor](https://www.paddlepaddle.org.cn/documentation/docs/zh/develop/api/paddle/vision/transforms/to_tensor_cn.html#paddle/vision/transforms/to_tensor_cn#cn-api-paddle-vision-transforms-to_tensor) | ||
|
|
||
| ```python | ||
| paddle.vision.transforms.to_tensor(pic, data_format) |
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.
data_format默认参数
parse.mask_a
Outdated
| @@ -0,0 +1,440 @@ | |||
| Help on class SGD in module paddle.optimizer.sgd: | |||
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.
这个文件是不是一个本地文件?

No description provided.