Uploaded image for project: 'AI Platform Core Components'
  1. AI Platform Core Components
  2. AIPCC-5681

BUG: `torch.pow(-0.0)` wrongly returns `-0.0` (should be +0.0)

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • PyTorch
    • None
    • PyTorch Sprint 15, PyTorch Sprint 16, PyTorch Sprint 17

          1. 🐛 Describe the bug

      The following code reproduces the bug:

      ```python
      import torch
      x = torch.tensor([0.0, -0.0])
      print(torch.pow(x, 0.5), torch.pow(x, 0.6))
      ```

      prints

      ```
      tensor([0., -0.]) tensor([0., 0.])
      ```

      According to IEEE spec as well as Array API spec, `pow(-0.0, 0.5)` should return `+0.0`. But the above code returns `-0.0`.

          1. Versions

      PyTorch version: 2.3.0
      Is debug build: False
      CUDA used to build PyTorch: None
      ROCM used to build PyTorch: N/A

      OS: macOS 14.4.1 (arm64)
      GCC version: Could not collect
      Clang version: 15.0.0 (clang-1500.3.9.4)
      CMake version: version 3.25.2
      Libc version: N/A

      Python version: 3.11.9 (main, Apr 2 2024, 08:25:04) [Clang 15.0.0 (clang-1500.3.9.4)] (64-bit runtime)
      Python platform: macOS-14.4.1-arm64-arm-64bit
      Is CUDA available: False
      CUDA runtime version: No CUDA
      CUDA_MODULE_LOADING set to: N/A
      GPU models and configuration: No CUDA
      Nvidia driver version: No CUDA
      cuDNN version: No CUDA
      HIP runtime version: N/A
      MIOpen runtime version: N/A
      Is XNNPACK available: True

      CPU:
      Apple M1

      Versions of relevant libraries:
      [pip3] numpy==1.26.4
      [pip3] torch==2.3.0
      [conda] Could not collect

      cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @albanD @malfet

              rh-ee-visgoyal Vishal Goyal
              rh-ee-visgoyal Vishal Goyal
              PyTorch Core
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: