【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)2 -part#6890
Merged
zhwesky2010 merged 8 commits intoPaddlePaddle:developfrom Sep 29, 2024
Merged
【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)2 -part#6890zhwesky2010 merged 8 commits intoPaddlePaddle:developfrom
zhwesky2010 merged 8 commits intoPaddlePaddle:developfrom
Conversation
zhwesky2010
reviewed
Sep 24, 2024
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.frombuffer.md
Outdated
Show resolved
Hide resolved
zhwesky2010
reviewed
Sep 25, 2024
Collaborator
zhwesky2010
left a comment
There was a problem hiding this comment.
写转写示例时:
要求尽可能简单,冗余的变量准备代码都不需要,写关键一行就行。
尽量就是一行对一行、或一行对多行
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.blackman_window.md
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.frombuffer.md
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.frombuffer.md
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.frombuffer.md
Outdated
Show resolved
Hide resolved
...des/model_convert/convert_from_pytorch/api_difference/torch/torch.get_num_interop_threads.md
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.get_num_threads.md
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.set_num_threads.md
Outdated
Show resolved
Hide resolved
zhwesky2010
reviewed
Sep 27, 2024
| torch.get_num_interop_threads() | ||
|
|
||
| # Paddle 写法 | ||
| return os.environ['OMP_NUM_THREADS'] |
Collaborator
There was a problem hiding this comment.
这个用multiprocessing.cpu_count()还是os.environ['OMP_NUM_THREADS']更符合点?
| torch.get_num_threads() | ||
|
|
||
| # Paddle 写法 | ||
| return multiprocessing.cpu_count() |
Collaborator
There was a problem hiding this comment.
这个和os.environ['CPU_NUM'] 哪个更合适
| | - | window | 窗函数类型,Pytorch 无此参数,Paddle 需设置为 `hamming`。 | | ||
| | window_length | win_length | 输入窗口的长度,仅参数名不同。 | | ||
| | periodic | fftbins | 判断是否返回适用于过滤器设计的对称窗口,功能相反,需要转写。 | | ||
| | alpha | - | 窗函数中非线性部分的衰减速度,Paddle 无此参数,暂无转写方式。 | |
Collaborator
There was a problem hiding this comment.
这个没有转写方式吗?看其他的窗函数std、alpha都能转写
Contributor
Author
There was a problem hiding this comment.
paddle:
def _hamming(M: int, sym: bool = True, dtype: str = 'float64') -> Tensor:
"""Compute a Hamming window.
The Hamming window is a taper formed by using a raised cosine with
non-zero endpoints, optimized to minimize the nearest side lobe.
"""
return _general_hamming(M, 0.54, sym, dtype=dtype)参数固定了。
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hann_window.md
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hann_window.md
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.hamming_window.md
Outdated
Show resolved
Hide resolved
docs/guides/model_convert/convert_from_pytorch/api_difference/torch/torch.blackman_window.md
Outdated
Show resolved
Hide resolved
zhwesky2010
approved these changes
Sep 29, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Paddle 代码转换工具新增 API 转换规则(第 3 组) part 2