Thank you for your reply!
I don’t have any zero length targets so this should not be a problem.
I did not understand exactly what do you mean by “invalid” sample: in my example above it happens if lengths_target[i] >  lengths_input[i]  for some i?
I will check the zero_infinity option, thank you!