-
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
转换规则 No. 10 #170
Changes from 42 commits
7220d31
421082c
94052b2
240c942
932539b
4f9fe54
f0514ae
f19c1e9
8aece8b
d290778
af29221
f211c16
d4afe68
305310d
6b141f5
5391062
cc447a0
16405d7
99948c7
480b26f
e468b93
2b42e83
ecc1b9c
0d0ffc2
dd27616
beaa6fa
bfb3dfc
48941d3
4f328f5
0904eff
a7bd400
e014679
567f49b
ad58800
68611af
205a64d
c7be7c7
81708fb
22ec03f
242b317
1ecc4c5
26dab40
5b0e18e
e678380
4de4947
e6483e4
6da74b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9982,6 +9982,26 @@ | |
"out" | ||
] | ||
}, | ||
"torch.stft": { | ||
"Matcher": "GenericMatcher", | ||
"paddle_api": "paddle.signal.stft", | ||
"args_list": [ | ||
"input", | ||
"n_fft", | ||
"hop_length", | ||
"win_length", | ||
"window", | ||
"center", | ||
"pad_mode", | ||
"normalized", | ||
"onesided", | ||
"return_complex" | ||
], | ||
"kwargs_change": { | ||
"input": "x", | ||
"return_complex": "onesided" | ||
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. 这里把 如果认为 目前这个写法 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. 收到,已改 |
||
} | ||
}, | ||
"torch.sub": { | ||
"Matcher": "SubMatcher", | ||
"args_list": [ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# 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(): | ||
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. 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. 已加。CI已过,请有空审核 |
||
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"]) |
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.
这两个参数不是对应的,需要针对return_complex单独处理下