-
Notifications
You must be signed in to change notification settings - Fork 53
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. 10 #170
Closed
Closed
转换规则 No. 10 #170
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
7220d31
fix
enkilee 421082c
fix
enkilee 94052b2
fix
enkilee 240c942
Merge branch 'master' into master
enkilee 932539b
fix
enkilee 4f9fe54
remove stft
enkilee f0514ae
add stft
enkilee f19c1e9
fix
enkilee 8aece8b
fix
enkilee d290778
fix
enkilee af29221
fix
enkilee f211c16
fix
enkilee d4afe68
fix
enkilee 305310d
fix
enkilee 6b141f5
fix
enkilee 5391062
fix
enkilee cc447a0
fix
enkilee 16405d7
fix
enkilee 99948c7
fix
enkilee 480b26f
fix
enkilee e468b93
fix
enkilee 2b42e83
fix
enkilee ecc1b9c
Merge branch 'optest-stft' of https://github.com/enkilee/PaConvert in…
enkilee 0d0ffc2
fix
enkilee dd27616
fix
enkilee beaa6fa
fix
enkilee bfb3dfc
fix
enkilee 48941d3
fix
enkilee 4f328f5
fix
enkilee 0904eff
fix
enkilee a7bd400
fix
enkilee e014679
fix
enkilee 567f49b
fix
enkilee ad58800
fix
enkilee 68611af
fix
enkilee 205a64d
fix
enkilee c7be7c7
fix
enkilee 81708fb
fix
enkilee 22ec03f
fix
enkilee 242b317
Merge branch 'master' into optest-stft
enkilee 1ecc4c5
fix
enkilee 26dab40
fix
enkilee 5b0e18e
add unitest
enkilee e678380
add unittest
enkilee 4de4947
Merge branch 'PaddlePaddle:master' into optest-stft
enkilee e6483e4
CI
enkilee 6da74b8
Merge branch 'master' into optest-stft
enkilee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
import textwrap | ||
|
||
from apibase import APIBase | ||
|
||
obj = APIBase("torch.stft") | ||
|
||
|
||
def test_case_1(): | ||
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
x = torch.tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], | ||
[-0.7401, -0.8805, -0.3402, -1.1936], | ||
[ 0.4907, -1.3948, -1.0691, -0.3132], | ||
[-1.6092, 0.5419, -0.2993, 0.3195]]) | ||
n_fft = 4 | ||
result = torch.stft(x, n_fft=n_fft, return_complex=True) | ||
""" | ||
) | ||
obj.run(pytorch_code, ["result"]) | ||
|
||
|
||
def test_case_2(): | ||
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
x = torch.tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], | ||
[-0.7401, -0.8805, -0.3402, -1.1936], | ||
[ 0.4907, -1.3948, -1.0691, -0.3132], | ||
[-1.6092, 0.5419, -0.2993, 0.3195]]) | ||
n_fft = 4 | ||
hop_length = 4 | ||
result = torch.stft(x, n_fft=n_fft, hop_length=hop_length, return_complex=True) | ||
""" | ||
) | ||
obj.run(pytorch_code, ["result"]) | ||
|
||
|
||
def test_case_3(): | ||
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
x = torch.tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], | ||
[-0.7401, -0.8805, -0.3402, -1.1936], | ||
[ 0.4907, -1.3948, -1.0691, -0.3132], | ||
[-1.6092, 0.5419, -0.2993, 0.3195]]) | ||
n_fft = 4 | ||
win_length = 4 | ||
result = torch.stft(x, n_fft=n_fft, win_length=win_length, return_complex=True) | ||
""" | ||
) | ||
obj.run(pytorch_code, ["result"]) | ||
|
||
|
||
def test_case_4(): | ||
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
x = torch.tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], | ||
[-0.7401, -0.8805, -0.3402, -1.1936], | ||
[ 0.4907, -1.3948, -1.0691, -0.3132], | ||
[-1.6092, 0.5419, -0.2993, 0.3195]]) | ||
n_fft = 4 | ||
result = torch.stft(x, n_fft=n_fft, center=False, return_complex=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这四种情况需要都测到:
|
||
""" | ||
) | ||
obj.run(pytorch_code, ["result"]) | ||
|
||
|
||
def test_case_5(): | ||
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
x = torch.tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], | ||
[-0.7401, -0.8805, -0.3402, -1.1936], | ||
[ 0.4907, -1.3948, -1.0691, -0.3132], | ||
[-1.6092, 0.5419, -0.2993, 0.3195]]) | ||
n_fft = 4 | ||
win_length = 4 | ||
result = torch.stft(x, n_fft=n_fft, center=False, win_length=win_length, return_complex=True) | ||
""" | ||
) | ||
obj.run(pytorch_code, ["result"]) | ||
|
||
|
||
def test_case_6(): | ||
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
x = torch.tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], | ||
[-0.7401, -0.8805, -0.3402, -1.1936], | ||
[ 0.4907, -1.3948, -1.0691, -0.3132], | ||
[-1.6092, 0.5419, -0.2993, 0.3195]]) | ||
n_fft = 4 | ||
hop_length = 4 | ||
win_length = 4 | ||
result = torch.stft(x, n_fft=n_fft, center=False, hop_length=hop_length, win_length=win_length, return_complex=True) | ||
""" | ||
) | ||
obj.run(pytorch_code, ["result"]) | ||
|
||
|
||
def test_case_7(): | ||
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
x = torch.tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], | ||
[-0.7401, -0.8805, -0.3402, -1.1936], | ||
[ 0.4907, -1.3948, -1.0691, -0.3132], | ||
[-1.6092, 0.5419, -0.2993, 0.3195]]) | ||
n_fft = 4 | ||
result = torch.stft(x, n_fft=n_fft, center=False, normalized=True, return_complex=True) | ||
""" | ||
) | ||
obj.run(pytorch_code, ["result"]) | ||
|
||
|
||
def test_case_8(): | ||
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
x = torch.tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], | ||
[-0.7401, -0.8805, -0.3402, -1.1936], | ||
[ 0.4907, -1.3948, -1.0691, -0.3132], | ||
[-1.6092, 0.5419, -0.2993, 0.3195]]) | ||
n_fft = 4 | ||
hop_length = 4 | ||
result = torch.stft(x, n_fft=n_fft, center=False, hop_length=hop_length, normalized=True, return_complex=True) | ||
""" | ||
) | ||
obj.run(pytorch_code, ["result"]) | ||
|
||
|
||
def test_case_9(): | ||
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
x = torch.tensor([[ 1.3398, 0.2663, -0.2686, 0.2450], | ||
[-0.7401, -0.8805, -0.3402, -1.1936], | ||
[ 0.4907, -1.3948, -1.0691, -0.3132], | ||
[-1.6092, 0.5419, -0.2993, 0.3195]]) | ||
n_fft = 4 | ||
win_length = 4 | ||
result = torch.stft(x, n_fft=n_fft, center=False, win_length=win_length, normalized=True, return_complex=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 增加一下测试case: |
||
""" | ||
) | ||
obj.run(pytorch_code, ["result"]) |
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.
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.
单测case需要加一些,这个API参数很多,可以写七八个case
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.
已加。CI已过,请有空审核