MPS: Fix crashes in view tensors due to buffer size mismatch (#78496)
Fixes #78247, #77886
Pull Request resolved: https://github.com/pytorch/pytorch/pull/78496
Approved by: https://github.com/albanD, https://github.com/malfet
(cherry picked from commit 017b0ae9431ae3780a4eb9bf6d8865dfcd02cd92)