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

【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)2 -part #6890

Merged
merged 8 commits into from
Sep 29, 2024

Conversation

enkilee
Copy link
Contributor

@enkilee enkilee commented Sep 24, 2024

@luotao1 luotao1 added the PaddlePaddle Hackathon 飞桨黑客松活动issue与PR label Sep 25, 2024
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.get_num_interop_threads()

# Paddle 写法
return os.environ['OMP_NUM_THREADS']
Copy link
Collaborator

Choose a reason for hiding this comment

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

不需要return

Copy link
Collaborator

Choose a reason for hiding this comment

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

这个用multiprocessing.cpu_count()还是os.environ['OMP_NUM_THREADS']更符合点?

torch.get_num_threads()

# Paddle 写法
return multiprocessing.cpu_count()
Copy link
Collaborator

Choose a reason for hiding this comment

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

不需要return

Copy link
Collaborator

Choose a reason for hiding this comment

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

这个和os.environ['CPU_NUM'] 哪个更合适

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已改。

| - | window | 窗函数类型,Pytorch 无此参数,Paddle 需设置为 `hamming`。 |
| window_length | win_length | 输入窗口的长度,仅参数名不同。 |
| periodic | fftbins | 判断是否返回适用于过滤器设计的对称窗口,功能相反,需要转写。 |
| alpha | - | 窗函数中非线性部分的衰减速度,Paddle 无此参数,暂无转写方式。 |
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个没有转写方式吗?看其他的窗函数std、alpha都能转写

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:

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)

参数固定了。

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.

LGTM

注意事项:

  1. 后续根据该文档来实现Matcher,注意不要出现文档与Matcher的diff。
  2. 如果实现Matcher的过程中,发现文档有误,需及时回头更正文档

@luotao1 luotao1 changed the title 【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组) part 2 【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)-part Sep 29, 2024
@zhwesky2010 zhwesky2010 changed the title 【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)-part 【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)- part2 Sep 29, 2024
@zhwesky2010 zhwesky2010 merged commit 8887e8d into PaddlePaddle:develop Sep 29, 2024
2 checks passed
@luotao1 luotao1 changed the title 【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)- part2 【Hackathon 7th No.36】为 Paddle 代码转换工具新增 API 转换规则(第 3 组)2 -part Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor PaddlePaddle Hackathon 飞桨黑客松活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants