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.
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
fix compat breaking: revive workaround padding in decode() #867
fix compat breaking: revive workaround padding in decode() #867
Changes from 11 commits
9daeb90
d1be041
eb26303
0b8c9b5
2e6b018
101b3e7
8a44a37
a4e64db
7a4ad06
db7a3b6
510d16d
9d1e656
88293ca
255a3ef
ce545a9
6d45309
7c1d79c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
(細かいですが)
start>=0も確認した方が良さそう
あと原理上end>lengthを確認したならstart>lengthは自明そう?(なので処理が簡単になりそう)
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.
#867 (comment)でも書きましたが、型的に無意味というかむしろそれを書いたらリンタが激怒すると思います。
(おそらく言語問わず)$\texttt{start} \leq \texttt{end}$ とは限らないと思います。
現状だと$\texttt{start} > \texttt{end}$ も、#867 (comment)の表の通り、 $\texttt{start}, \texttt{end} < \texttt{length}$ である限りは空の区間として受け取ることになるかなと。
ただ今考えたら、一貫性のために$\texttt{start} > \texttt{end}$ もついでに弾いておくという判断もありかもしれません。どうしましょうか?
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.
start > end
はRangeインスタンスの生成時に落ちるものと思ってたんですが、ドキュメントを見た感じそうでもなさそうですかね?バリデーションは積極的に通すみたいな方針にするというのをどこかで話した気がするのでこれもpanicさせましょうか
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.
そうですね。
Range
自体はただの二つの整数の組です。あと10..0
みたいなのも、Pythonのslice
じゃなくrange
的な使い方をする分には空のイテレータを返します。リンタには怒られますが。ですね。パニックにしちゃいましょう。パニックメッセージ的にはこう?
Python API側は
IndexError
じゃなくてValueError
にすればよさそう。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.
あ、30分前にコミットされてましたね。これでよさそう。
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.
今気付いたのですが、ONNX Runtimeに渡すのはマージン入れたやつでは?なので別に早期リターンは要らないのでは…?
あとこれ↓についてはいかがいたしましょう
#867 (comment)
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でstart > endで落ちる例が思いつきません
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ではありえないからこそ、
IndexError
は避けた方がよいのではないかと思いました。ValueError
はJavaで言うIllegalArgumentException
だと理解しています。あとissubclass(IndexError, LookupError)
なので、AudioFeatureのlengthに関わらずstart > end
は不正ということで、ValueError
でいいんじゃないかなーと思った次第です。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.
なるほど、ValueErrorにします
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.
これについてですがRustの
[T]
ではが
slice index starts at 5000 but ends at 1000
というメッセージになる(i.e.range start index {i} out of range for slice of length {len}
やrange end index {i} out of range for slice of length {len}
よりも優先される)ので、それにならうという意味でもやった方がいいかなと思いました。