Implement cosine similarity between two vectors.
$$\text{cos\_sim}(a, b) = \frac{a \cdot b}{\|a\| \cdot \|b\|}$$
where $\|a\| = \sqrt{\sum_i a_i^2}$ is the L2 norm.
Input: Two 1D tensors a and b of the same shape
Output: A scalar representing the cosine similarity (value between -1 and 1)