转换规则 No. 10
PR Docs
- https://github.com/PaddlePaddle/PaConvert/issues/112 10
- https://github.com/PaddlePaddle/docs/pull/6007
PR APIs
paddle.signal.stft
Thanks for your contribution!
单测未通过,也需要修复
@zhwesky2010 AssertionError: API (torch.stft): shape mismatch, torch shape is (1, 9, 9), paddle shape is (1, 16, 9) 我在pytorch测试的结果是(1, 9, 9),在aistudio相同数据的结果也是(1, 9, 9)。不知为什么这里是 (1, 16, 9)
@zhwesky2010 请问,这种要如何追问题?
2023-07-20 12:42:10 File "/workspace/a4bba61b-0eea-44b9-8d1b-5a4732f9836f/PaConvert/paconvert/../paconvert/transformer/basic_transformer.py", line 550, in visit_FunctionDef
2023-07-20 12:42:10 super(BasicTransformer, self).generic_visit(node)
2023-07-20 12:42:10 File "/root/anaconda3/lib/python3.10/ast.py", line 494, in generic_visit
2023-07-20 12:42:10 value = self.visit(value)
2023-07-20 12:42:10 File "/workspace/a4bba61b-0eea-44b9-8d1b-5a4732f9836f/PaConvert/paconvert/../paconvert/base.py", line 82, in visit
2023-07-20 12:42:10 node = super(BaseTransformer, self).visit(node)
2023-07-20 12:42:10 File "/root/anaconda3/lib/python3.10/ast.py", line 418, in visit
2023-07-20 12:42:10 return visitor(node)
2023-07-20 12:42:10 File "/root/anaconda3/lib/python3.10/ast.py", line 503, in generic_visit
2023-07-20 12:42:10 new_node = self.visit(old_value)
2023-07-20 12:42:10 File "/workspace/a4bba61b-0eea-44b9-8d1b-5a4732f9836f/PaConvert/paconvert/../paconvert/base.py", line 82, in visit
2023-07-20 12:42:10 node = super(BaseTransformer, self).visit(node)
2023-07-20 12:42:10 File "/root/anaconda3/lib/python3.10/ast.py", line 418, in visit
2023-07-20 12:42:10 return visitor(node)
2023-07-20 12:42:10 File "/workspace/a4bba61b-0eea-44b9-8d1b-5a4732f9836f/PaConvert/paconvert/../paconvert/transformer/basic_transformer.py", line 314, in visit_Call
2023-07-20 12:42:10 node_list = matcher.get_paddle_nodes(node.args, node.keywords)
2023-07-20 12:42:10 File "/workspace/a4bba61b-0eea-44b9-8d1b-5a4732f9836f/PaConvert/paconvert/../paconvert/base.py", line 397, in get_paddle_nodes
2023-07-20 12:42:10 new_code = self.generate_code(new_kwargs)
2023-07-20 12:42:10 File "/workspace/a4bba61b-0eea-44b9-8d1b-5a4732f9836f/PaConvert/paconvert/../paconvert/api_matcher.py", line 3170, in generate_code
2023-07-20 12:42:10 kwargs["onesided"],
2023-07-20 12:42:10 KeyError: 'onesided'
return_complex 时,可使用as_real、as_complex进行转换处理
收到,我尽快处理,抱歉
按照文档的说法,不知道我理解的对不对: pytorch: return_complex : Changed in version 2.0: return_complex is now a required argument for real inputs, as the default is being transitioned to True. 也就是说,现在在pytorch中, return_complex 默认为true, 输入数据为实信号,而且是必须为true? Deprecated since version 2.0: return_complex=False is deprecated, instead use return_complex=True Note that calling torch.view_as_real() on the output will recover the deprecated output format. 如果把return_complex设置为false,则需要调用torch.view_as_real()把结果换成real形式展示输出。
在paddle中: onesided (bool,可选) - 当输入为实信号时,选择是否只返回傅里叶变换结果的一半的频点值(输入信号和窗函数均为实数时,傅里叶变换结果具有共轭对称性)。如果输入的信号或者窗函数的数据类型是复数,则此时不能设置为 True。默认为 True;
也就是说,onesided为false时,输入的是复数,可是pytorch2.0的输入必须为实信号,所以paddle的onesided值只能是True吧。
但你这个和映射文档中的参数映射对不上吧,麻烦检查下文档是不是有问题 https://github.com/PaddlePaddle/docs/blob/develop/docs/guides/model_convert/convert_from_pytorch/api_difference/ops/torch.stft.md
收到,我把文档改下。
No.10 的文档改了: https://github.com/PaddlePaddle/docs/pull/6164