[BE] Cleanup where_self_out (#121494)
- Avoid extra assignments by using ternary instead of if-else
- Do not call type-cast unless it is needed (in most cases only one of two arguments will need to be custed)
- Avoid extra assignment for condition_, by calling `cast` under `if` condition
Pull Request resolved: https://github.com/pytorch/pytorch/pull/121494
Approved by: https://github.com/albanD, https://github.com/Skylion007
ghstack dependencies: #121473