I give you my current example.
I obtain two tensor which are [1,3,512,512] by neural network.
I mean that I want to calculate cosine similarity of four-dim tensor.
Can I use torch.cosine_similarity(input1,input2,dim=3)?
Or I only compute the sum of each dimension first, and then average each dimension.