I have a little difficulty understanding what happens when we use pytorch cosine similarity function.
considering this example:
input1 = torch.abs(torch.randn(1,2,20, 20))
input2 = torch.abs(torch.randn(1,2,20, 20))
cos = nn.CosineSimilarity(dim=1, eps=1e-6)
output = cos(input1, input2)
print(output.size())

torch.Size([20, 20])

I was expecting to get the output of size 2x20x20, can someone please explain to me why it is not like that??
Moreover, is there a way to compute the CosineSimilarity for each channel separately and get an output of size  2x20x20??
Thanks