【发布时间】:2021-02-03 16:32:19
【问题描述】:
我开始使用 Kymatio 库,以便将散射变换用作一维信号特征的提取器。最后的想法是对一维信号进行分类。
我按照链接中的示例进行操作
https://www.kymat.io/gallery_1d/plot_classif_torch.html#sphx-glr-gallery-1d-plot-classif-torch-py
基于此示例,我导入了三个 .mat 文件,其中包含来自 COOLL 数据集 (https://coolldataset.github.io/) 的编译数据。导入了两个变量:
x2 包含电器电流的值。 x2 是一个 840 行 4 * 8192 列的矩阵。 y2 包含标签列表。它有 840 个位置,每个设备一个位置。
我正在尝试为 x2 包含的每个信号计算 Scattering1D 变换的系数。为此,我正在执行以下操作:
T=32768;
J=8;
Q=12;
if use_cuda:
scattering.cuda()
x2 = x2.cuda()
y2 = y2.cuda()
Sx_all = scattering.forward(x2)
当我这样做时,会出现以下错误:
RuntimeError Traceback (most recent call last)
<ipython-input-62-26c538d90a70> in <module>()
1 #Sx_all = scattering(x2)
----> 2 Sx_all = scattering.forward(x2)
1 frames
/usr/local/lib/python3.6/dist-packages/kymatio/backend/torch_backend.py in input_checks(x)
9
10 if not x.is_contiguous():
---> 11 raise RuntimeError('The input must be contiguous.')
12
13 def _is_complex(x):
RuntimeError: The input must be contiguous.
运行原始程序时不会出现此错误,来自https://www.kymat.io/gallery_1d/plot_classif_torch.html#sphx-glr-gallery-1d-plot-classif-torch-py 的示例。
错误消息“输入必须是连续的”究竟是什么意思,您建议我如何解决该问题?我尝试阅读库文档,但仍然没有解决问题。
【问题讨论】:
标签: python pytorch classification