(Solved)No cosine_similarity function defined

it’s very strange.
I run a official example about cosine similarity, but ‘module’ object has no attribute ‘cosine_similarity’.

AttributeError                            Traceback (most recent call last)
<ipython-input-84-29bc0b9e4a3b> in <module>()
----> 1 torch.nn.functional.cosine_similarity

AttributeError: 'module' object has no attribute 'cosine_similarity'

It’s a bug?

I check the functional.py document.
There is no consine_similarity function defined. You can go the official website and copy the code, paste in the functional.py