From the Wikipedia the Russian supercavitating torpedo Shkval does reach a speed of 103 m/s and does have a range of about 15 km (8.1 NM).
This means, if we ignore the time needed for acceleration for simplification, that such a torpedo reaches its max range in a timeframe of around 146 s (2 min and 43 s).
With acceleration it will take a little longer.
https://en.wikipedia.org/wiki/VA-111_Shkval
That's extremely fast.
Now, let's assume the submarine can't escape the torpedo , which means it's distance + the distance it can travel at max speed is lower than the torpedos max range and let's also assume it is diving at a starting speed of 5 knots and has a max speed of 20 knots, then the question is:
Will it have a chance to evade such a supercavitating torpedo?
And if your answer is yes, how?