Skip to content
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

映射文档 No. 271/273/280/283/297/298/301/325/337/339-348 #6020

Merged
merged 4 commits into from
Jul 18, 2023

Conversation

co63oc
Copy link
Contributor

@co63oc co63oc commented Jul 13, 2023

PaddlePaddle/PaConvert#112

271 torch.vsplit
273 torch.hsplit
280 torch.Tensor.hsplit
283 torch.Tensor.vsplit
297 torch.Tensor.dsplit
hsplit vsplit dsplit 在torch中对应torch.tensor_split,indices_or_sections 参数是序号,不是区块数,paddle.split中为区块数,所以不匹配

298 torch.Tensor.bitwise_right_shift
301 torch.bitwise_right_shift
325 torch.Tensor.is_conj
337 torch.is_conj
339 torch.diagonal_scatter
340 torch.select_scatter
341 torch.slice_scatter
342 torch.scatter_reduce
343 torch.set_deterministic_debug_mode
344 torch.get_deterministic_debug_mode
345 torch.Tensor.diagona_scatter
346 torch.Tensor.scatter_reduce
347 torch.Tensor.select_scatter
348 torch.Tensor.slice_scatter

paddle列表没有 bitwise_right_shift
图片

is_conj搜索结果为空
图片

scatter没有匹配api
图片

deterministic_debug
图片

@paddle-bot
Copy link

paddle-bot bot commented Jul 13, 2023

感谢你贡献飞桨文档,文档预览构建中,Docs-New 跑完后即可预览,预览链接:http://preview-pr-6020.paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html
预览工具的更多说明,请参考:飞桨文档预览工具

@co63oc co63oc changed the title 映射文档 No. 298/301 映射文档 No. 298/301/325/337 Jul 13, 2023
@co63oc co63oc changed the title 映射文档 No. 298/301/325/337 映射文档 No. 298/301/325/337/339-348 Jul 13, 2023
@co63oc co63oc changed the title 映射文档 No. 298/301/325/337/339-348 映射文档 No. 271/273/280/283/297/298/301/325/337/339-348 Jul 15, 2023
@@ -285,6 +285,16 @@
| 253 | [torch.nanmean](https://pytorch.org/docs/1.13/generated/torch.nanmean.html?highlight=nanmean#torch.nanmean) | [paddle.nanmean](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/nanmean_cn.html) | 功能一致, torch 参数更多 , [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.nanmean.md) |
| 254 | [torch.take_along_dim](https://pytorch.org/docs/1.13/generated/torch.take_along_dim.html?highlight=torch+take_along_dim#torch.take_along_dim) | [paddle.take_along_axis](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/paddle/take_along_axis_cn.html) | 功能一致, torch 参数更多 , [差异对比](https://github.com/PaddlePaddle/docs/tree/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.take_along_dim.md) |
| 254 | [torch.geqrf](https://pytorch.org/docs/stable/generated/torch.geqrf.html?highlight=geqrf#torch.geqrf) | | 功能缺失 |
| 255 | [torch.bitwise_right_shift](https://pytorch.org/docs/1.13/generated/torch.bitwise_right_shift.html#torch.bitwise_right_shift) | | 功能缺失 |
Copy link
Contributor

Choose a reason for hiding this comment

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

这些api有可以组合实现吗,用一些paddle已有的API实现这些功能。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

需要增加PaConvert转换规则,如果组合复杂没有合适转换规则

| 260 | [torch.scatter_reduce](https://pytorch.org/docs/1.13/generated/torch.scatter_reduce.html#torch.scatter_reduce) | | 功能缺失 |
| 261 | [torch.set_deterministic_debug_mode](https://pytorch.org/docs/1.13/generated/torch.set_deterministic_debug_mode.html#torch.set_deterministic_debug_mode) | | 功能缺失 |
| 262 | [torch.get_deterministic_debug_mode](https://pytorch.org/docs/1.13/generated/torch.get_deterministic_debug_mode.html#torch.get_deterministic_debug_mode) | | 功能缺失 |
| 263 | [torch.vsplit](https://pytorch.org/docs/1.13/generated/torch.vsplit.html#torch.vsplit) | | 功能缺失 |
Copy link
Contributor

Choose a reason for hiding this comment

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

这些都缺失吗,paddle.vsplit能实现吗

Copy link
Contributor

@ROckDog22 ROckDog22 Jul 18, 2023

Choose a reason for hiding this comment

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

split相关的可以看看, torch和paddle API存在diff,但是看看像SplitMatcher一样能不能转

class SplitMatcher(BaseMatcher):
    def generate_code(self, kwargs):
        if "dim" in kwargs:
            axis = kwargs["dim"]
        else:
            axis = 0

        if "[" in kwargs["split_size_or_sections"]:
            API_TEMPLATE = textwrap.dedent(
                """
                paddle.split(x={}, num_or_sections={}, axis={})
                """
            )
            code = API_TEMPLATE.format(
                kwargs["tensor"], kwargs["split_size_or_sections"], axis
            )
        else:
            API_TEMPLATE = textwrap.dedent(
                """
                paddle.split(x={}, num_or_sections={}.shape[{}]//{}, axis={})
                """
            )
            code = API_TEMPLATE.format(
                kwargs["tensor"],
                kwargs["tensor"],
                axis,
                kwargs["split_size_or_sections"],
                axis,
            )
        return code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

split相关的可以看看, torch和paddle API存在diff,但是看看像SplitMatcher一样能不能转

class SplitMatcher(BaseMatcher):
    def generate_code(self, kwargs):
        if "dim" in kwargs:
            axis = kwargs["dim"]
        else:
            axis = 0

        if "[" in kwargs["split_size_or_sections"]:
            API_TEMPLATE = textwrap.dedent(
                """
                paddle.split(x={}, num_or_sections={}, axis={})
                """
            )
            code = API_TEMPLATE.format(
                kwargs["tensor"], kwargs["split_size_or_sections"], axis
            )
        else:
            API_TEMPLATE = textwrap.dedent(
                """
                paddle.split(x={}, num_or_sections={}.shape[{}]//{}, axis={})
                """
            )
            code = API_TEMPLATE.format(
                kwargs["tensor"],
                kwargs["tensor"],
                axis,
                kwargs["split_size_or_sections"],
                axis,
            )
        return code

PaddlePaddle/PaConvert#148
图片
是要匹配torch.tensor_split

Copy link
Contributor

Choose a reason for hiding this comment

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

好的

@zhwesky2010 zhwesky2010 merged commit dc1e699 into PaddlePaddle:develop Jul 18, 2023
1 check passed
@co63oc co63oc deleted the right_shift branch July 25, 2023 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants