PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.07k stars 5.55k forks source link

paddle.nn.functional.fold The `output_width` should be greater than one, 但是torch版本没问题 #67985

Open zouhan6806504 opened 1 week ago

zouhan6806504 commented 1 week ago

bug描述 Describe the Bug

aistudio环境 2.5和3.0都一样

import paddle
a = paddle.randn((2, 16640, 64))
out = paddle.nn.functional.fold(a, output_sizes=(4096, 1), kernel_sizes=[65, 1], paddings=[1, 0], strides=[64, 1])
print(out.shape)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[2], line 3
      1 import paddle
      2 a = paddle.randn((2, 16640, 64))
----> 3 out = paddle.nn.functional.fold(a, output_sizes=(4096, 1), kernel_sizes=[65, 1], paddings=[1, 0], strides=[64, 1])
      4 print(out.shape)

File /opt/conda/envs/python35-paddle120-env/lib/python3.10/site-packages/paddle/nn/functional/common.py:2405, in fold(x, output_sizes, kernel_sizes, strides, paddings, dilations, name)
   2399     raise ValueError(
   2400         "Unexpected type of paddings, it should be either an integer or a list"
   2401         "of 2 or 4 integers"
   2402     )
   2404 if in_dynamic_mode():
-> 2405     out = _C_ops.fold(
   2406         x, output_sizes, kernel_sizes, strides, paddings, dilations
   2407     )
   2408 else:
   2409     out = helper.create_variable_for_type_inference(dtype=x.dtype)

ValueError: (InvalidArgument) The `output_width` should be greater than one, but received output_width: 1 .
  [Hint: Expected output_width > 1, but received output_width:1 <= 1:1.] (at /paddle/paddle/phi/infermeta/unary.cc:1603)

但是torch能执行正常

import torch
a = torch.rand((2, 16640, 64))
out = torch.nn.functional.fold(a, output_size=(4096, 1), kernel_size=[65, 1], padding=[1, 0], stride=[64, 1])
print(out.shape)

结果 torch.Size([2, 256, 4096, 1])

其他补充信息 Additional Supplementary Information

No response

warrentdrew commented 1 week ago

您好,感谢您的反馈,问题已反馈相关api负责人

zouhan6806504 commented 6 days ago

您好,感谢您的反馈,问题已反馈相关api负责人

请问最新进展如何,因为我想改写pytorch的一个模型,里面用到了这个