Files
pytorch/c10
Nikita Shulga 48f3158d1d [MPS] Migrate pow_tensor_scalar/reciprocal ops to Metal shaders (#170077)
Motivation is  to fix `torch.signal.windows.kaiser` (see https://github.com/pytorch/pytorch/issues/164712 ), which started to fail, because `c10::metal::pow(x, 2)` is no longer identical to `x * x`
- Redispatch to `reciprocal`/`sqrt`/`rsqrt` when scalar is `2.0`/`.5`/`-.5` respectively
- Implement pow operation for complex numbers using $a^b = e^{b \cdot \log(a)} = e^{b \cdot (\log(r) + i\theta)}$ if $a=r e^{i\theta}$
- This also fixes backward for `tanh`
Pull Request resolved: https://github.com/pytorch/pytorch/pull/170077
Approved by: https://github.com/Skylion007
2025-12-17 06:55:42 +00:00
..