Skip to content
  • On my laptop the output is:

    Testing edit distance in PyTorch vs. pure Python, with timeit
    Running for 2500 iterations, best of 3.
    Torch best: 3561.410 usec/loop, Python best: 554.336 usec/loop
  • Have you tried using numpy?

    In any case, it is not surprising that pytorch would be slower than python with these for-loops, given the overhead coming from the pytorch/autograd/tensor infrastructure. You can see for example the performance comparison for filters in torchaudio.

    Is your goal in using pytorch to have a differentiable edit_distance?

  • Note also that the filters mentioned above seem to perform best in pure C++ implementation, as we discussed offline. There is support for C++ extensions, e.g. here or pybind.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment