donalee/DTW-Pool

mistake in softdtw_cuda.py

Closed this issue · 1 comments

I tried to run the softdtw_cuda.py directly, but I got an error.

Profiling forward() + backward() times for batch_size=128, seq_len_a=17, seq_len_b=15, dims=2...
Traceback (most recent call last):
  File "softdtw_cuda.py", line 556, in <module>
    profile(128, 17, 15, 2, tol_backward=1e-6)
  File "softdtw_cuda.py", line 529, in profile
    t_gpu, forward_gpu, backward_gpu = timed_run(a_gpu, b_gpu, sdtw_cuda)
  File "softdtw_cuda.py", line 495, in timed_run
    forward = sdtw(a, b)
  File "/home/qar/.local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "softdtw_cuda.py", line 465, in forward
    func_dtw = self._get_func_dtw(X, Y)
  File "softdtw_cuda.py", line 399, in _get_func_dtw
    assert dx == dy  # Equal feature dimensions
AssertionError

In line 523 and line 524, you define the data with (batch_size, seq_len, dims), but in _get_func_dtw(self, x, y), you unpack the data with dimention (bx, dx, lx) and check the batch and dimention. However, the second dimention is actually the seq_len.

Hi, I checked this issue just now. Thanks for letting me know.