def _derive_all_squared_distances(
    X, n_samples, n_timestamps, shapelets, lengths, alpha
):
    """Derive the squared distances between all shapelets and time series."""
    distances = []  # save the distances in a list

    for i in prange(len(lengths)):
        window_size = lengths[i][0]
        X_window = _windowed_view(X, n_samples, n_timestamps,
                                  window_size, window_step=1)
        for j in prange(shapelets[i].shape[0]):
            dist = _derive_shapelet_distances(X_window, shapelets[i][j], alpha)
            distances.append(dist)

    return distances
Derive the squared distances between all shapelets and time series.
pyts/classification/learning_shapelets.py