Based on the docs 985, the output will have the same shape as the inputs without the dim which is used to compute the similarity.
So if you would like to use the batch dimension and get an output of [2, 20, 20], you could use dim=0.