Repository navigation
Validate n_mels in paddle.audio.functional.create_dct - #80029
Open
lanqing431 wants to merge 1 commit into
Open
lanqing431 wants to merge 1 commit into
lanqing431 wants to merge 1 commit into
Conversation
Contributor
Paddle-Bot Review Board (review完成)
可维护性建议(总分 94.3 / 100,只给建议,不影响评审结论)
各维度得分(仅评本 PR 改动,点击展开)
Powered by Nyanpasu claude with DeepSeek-V4.1-Flash 默认推理级别, please check the suggestions carefully. |
Paddle-Review-Bot
approved these changes
Nov 30, 2026
| Args: | ||
| n_mfcc (int): Number of mel frequency cepstral coefficients. | ||
| n_mels (int): Number of mel filterbanks. | ||
| n_mels (int): Positive number of mel filterbanks. |
Contributor
There was a problem hiding this comment.
💡 可维护性建议(契约一致性,不阻塞合入):本 PR 为 create_dct 新增了 n_mels <= 0 时抛出 ValueError 的错误契约,但 docstring 只把参数描述改成了 “Positive number”,没有 Raises: 段;而同模块的公开接口(如 resample、_get_sinc_resample_kernel)都会在 docstring 中声明 Raises:。建议在 Returns: 前后补充错误契约,例如:Raises: ValueError: If n_mels is not a positive integer.,让调用方从文档即可得知失败方式。
This branch has not been deployed
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.
PR Category
User Experience
PR Types
Bug fixes
Description
Validate that
n_melsis positive before building a DCT matrix. Zero previously raisedZeroDivisionError, and negative counts could either yield an empty result or fail with a math-domain error depending on normalization. Invalid counts now raise a parameter-specificValueErrorin either mode.The four new regression cases fail against the previous implementation. All 176 cases in
test_audio_functions.pypass with the checkout'screate_dctloaded over the Paddle 3.3.1 CPU wheel on Windows. Ruff check/format andgit diff --checkpassed.Fixes #79998.
是否引起精度变化
否