Fix SparseAttention cos/sin cache dimension checks (#20609)
### Description
This PR fixes the dimension checks for the cos/sin caches used in the
rotary embeddings in the `SparseAttention` operator.
### Motivation and Context
This PR ports over the same changes from [this
PR](https://github.com/microsoft/onnxruntime/pull/20547) for
`GroupQueryAttention`.