I ran finite differences and got a value that actually matched the gradient in question. If I actually implemented the gradient of the squared cosine similarity correctly, do you have any tips on implementing the gradient more efficiently?