Fastest way to compute cosine similarity in a GPU

Viewed 231

So I have a huge tfidf matrix with more than a million records, I would like to find the cosine similarity of this matrix with itself. I am using colab to run the code, but I am not sure how to best make use of the gpu provided by colab.

sequentially run code -

tfidf_matrix = tf.fit_transform(df['categories'])

cosine_similarities = linear_kernel(matrix, matrix)

Is there way we can parallelise the code using jit or any other way?

0 Answers
Related