ENH Adds check for input sizes in cosine_similarity (#58559)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/55273
Adds check for input sizes to be consistent with the docstring.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58559
Reviewed By: soulitzer
Differential Revision: D28562376
Pulled By: ailzhang
fbshipit-source-id: f292e8a26f11a40d146fbed94a28025794808216