Maghoumi / pytorch-softdtw-cuda

Fast CUDA implementation of (differentiable) soft dynamic time warping for PyTorch
MIT License
615 stars 59 forks source link

output the alignments of two sequences #31

Open XIDIANPQZ opened 1 year ago

XIDIANPQZ commented 1 year ago

Hello,thanks for the beautiful implementation of dtw!

I'm facing an issue when using this code. At first, I want to output the alignments of two sequences. Therefore, I change the output of forward function in class _SoftDTWCUDA. The new output is R instead of R[:, -2, -2]. When running loss.backward(), the error occurs: TypeError: backward() takes 2 positional arguments but 3 were given.

I would greatly appreciate it if you could assist me in understanding the cause of this issue and providing guidance on resolving it. Any insights you can offer would be invaluable.

Thank you in advance for your help!

XIDIANPQZ commented 1 year ago

I solve this problem by setting the equal number between forward output and backward input.

XIDIANPQZ commented 1 year ago

I would like to ask if there is any alignment information saved during the forward propagation process. If not then I have to write backtracking algorithm to generate it.