Skip to main content
edited title
Link

Similarities between two 2d-vectors. (to flatten or to not)

Source Link

Similarities between two 2d-vectors. (to flatten or to not)

I have this scenario where I need to measure the similarity between a 2d tensor t1: (100,8) and 61 tensors of the same shape(100,8). 100 represent time-steps and 8 is the no. of options.

I first tried flattening all tensors so that I can use the cosine similarity measure, but it slows down performance significantly.

I used pairwise comparisons without flattening like the approach below, but it made executing mathematical operations more complicated (e.g., diagonal operations): How to calculate a meaningful distance between multidimensional tensors.

What should I do to speed-up ops on flattened tensors/or are there alternatives to flattening?