pytorch使用pytorch_wavelets包错误:ValueError: step must be greater than zero 错误解决

错误描述

在使用pytorch_wavelets包的DWT1DInverse时,发现报错信息如下:
Traceback (most recent call last):
File "/work/GDN/test/test_DWT.py", line 24, in
x_ = idwt((YL, YH))
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 550, in call
result = self.forward(*input, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/pytorch_wavelets/dwt/transform1d.py", line 107, in forward
for x1 in highs[::-1]:
ValueError: step must be greater than zero

原因排查

查看包原码,发现有可能是tensor和np切片不同造成的保存,遂使用numpy转换之后再进入idwt
之后依然报错,查询github相应issue 发现是输入格式问题
正确格式:
test_ground= idwt((test_ground_l, [test_ground_h]))
错误格式:
test_ground= idwt((test_ground_l, test_ground_h))

参考文献

https://github.com/fbcotter/pytorch_wavelets/issues/43

posted @ 2024-03-15 20:53  David_Dong  阅读(158)  评论(0编辑  收藏  举报