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

istft算子动转静,输入不定长报错 #41748

Closed
jerryuhoo opened this issue Apr 13, 2022 · 7 comments
Closed

istft算子动转静,输入不定长报错 #41748

jerryuhoo opened this issue Apr 13, 2022 · 7 comments
Assignees
Labels
status/following-up 跟进中 type/debug 帮用户debug

Comments

@jerryuhoo
Copy link

jerryuhoo commented Apr 13, 2022

请提出你的问题 Please ask your question

用了InputSpec,由于输入是不定长的所以输入的shape是-1,请问如何解决呢?之前看到#40113 加入了stft和istft的支持。@KPatr1ck

        c = signal.istft(c, win_length=self.w_s, n_fft=self.f_s, hop_length=self.h_s, onesided=True, center=True)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
        c = c.unsqueeze(1)
        # print("istft", c)

    File "/root/miniconda3/lib/python3.8/site-packages/paddle/signal.py", line 548, in istft
        x=paddle.tile(
    File "/root/miniconda3/lib/python3.8/site-packages/paddle/tensor/manipulation.py", line 1815, in tile
        attrs['repeat_times'] = get_attr_repeat_times(repeat_times)
    File "/root/miniconda3/lib/python3.8/site-packages/paddle/tensor/manipulation.py", line 1806, in get_attr_repeat_times
        assert times > 0, (

    AssertionError: All elements in repeat_times must be positive for tile.
@paddle-bot-old
Copy link

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看官网API文档常见问题历史IssueAI社区来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQGithub Issue and AI community to get the answer.Have a nice day!

@LielinJiang
Copy link
Contributor

麻烦您提供下最小可复现的代码

@LielinJiang
Copy link
Contributor

repeat_times,应该是这个参数是小于0的,看看能否变成一个tensor

@jerryuhoo
Copy link
Author

麻烦您提供下最小可复现的代码

import paddle
from paddle.nn import Layer
from paddle.jit import to_static
from paddle.static import InputSpec
from paddle import signal

class SimpleNet(Layer):
    def __init__(self, ):
        super(SimpleNet, self).__init__()

    def forward(self, real_part, img_part):
        x = paddle.complex(real_part, img_part, name=None)
        out = signal.istft(x, win_length=12, n_fft=20, hop_length=3, onesided=True, center=True)
        return out

net = SimpleNet()
real_part = paddle.randn(shape=[1, 11, 1000])
img_part = paddle.randn(shape=[1, 11, 1000])


# 动态推理
print(net(real_part, img_part))

# 静态推理
net = to_static(net, input_spec=[InputSpec(shape=[1, 11, -1], name='real_part'), InputSpec(shape=[1, 11, -1], name='img_part')])
net(real_part, img_part)

报错信息:

AssertionError: In transformed code:

    File "test.py", line 13, in forward
        def forward(self, real_part, img_part):
            x = paddle.complex(real_part, img_part, name=None)
            out = signal.istft(x, win_length=12, n_fft=20, hop_length=3, onesided=True, center=True)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
            return out

    File "/usr/local/anaconda3/envs/paddlespeech/lib/python3.8/site-packages/paddle/signal.py", line 548, in istft
	x=paddle.tile(
    File "/usr/local/anaconda3/envs/paddlespeech/lib/python3.8/site-packages/paddle/tensor/manipulation.py", line 1810, in tile
	attrs['repeat_times'] = get_attr_repeat_times(repeat_times)
    File "/usr/local/anaconda3/envs/paddlespeech/lib/python3.8/site-packages/paddle/tensor/manipulation.py", line 1801, in get_attr_repeat_times
	assert times > 0, (

    AssertionError: All elements in repeat_times must be positive for tile.

@Ligoml Ligoml added status/following-up 跟进中 type/debug 帮用户debug and removed status/new-issue 新建 type/question 用户提问 labels Apr 18, 2022
@keetsky
Copy link

keetsky commented Nov 22, 2022

怎么解决的

@Lennon-cheng
Copy link

@LielinJiang @jerryuhoo 打扰两位,想问下问题解决了吗?可否介绍下解决方案?谢谢

@paddle-bot paddle-bot bot closed this as completed Mar 12, 2024
Copy link

paddle-bot bot commented Mar 12, 2024

Since you haven't replied for more than a year, we have closed this issue/pr.
If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up.
由于您超过一年未回复,我们将关闭这个issue/pr。
若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/following-up 跟进中 type/debug 帮用户debug
Projects
None yet
Development

No branches or pull requests

5 participants