Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

rand_like on permuted parameter not working on MPS #124029

Open
WinnieP opened this issue Apr 15, 2024 · 0 comments 路 May be fixed by #125231
Open

rand_like on permuted parameter not working on MPS #124029

WinnieP opened this issue Apr 15, 2024 · 0 comments 路 May be fixed by #125231
Labels
module: mps Related to Apple Metal Performance Shaders framework triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@WinnieP
Copy link

WinnieP commented Apr 15, 2024

馃悰 Describe the bug

Possible regression on #94190?
Calling torch.rand_like() on a tensor on mps device after it has gone through permute() doesn't work.

import torch

# Works
print("cpu")
t = torch.ones((3,2,2)).permute(2,0,1)
print(torch.rand_like(t))

# Not random
print("mps")
t = torch.ones((3,2,2)).to('mps').permute(2,0,1)
print(torch.rand_like(t))

# Somehow alters state?
t + 100
print(torch.rand_like(t))

Outputs:

cpu
tensor([[[0.4733, 0.7733],
         [0.6867, 0.6849],
         [0.9873, 0.9970]],

        [[0.8636, 0.9555],
         [0.6707, 0.1060],
         [0.9323, 0.1317]]])
mps
tensor([[[0., 0.],
         [0., 0.],
         [0., 0.]],

        [[0., 0.],
         [0., 0.],
         [0., 0.]]], device='mps:0')
tensor([[[101., 101.],
         [101., 101.],
         [101., 101.]],

        [[101., 101.],
         [101., 101.],
         [101., 101.]]], device='mps:0')

Tried on 2.2.2 and nightly

Versions

Collecting environment information...
PyTorch version: 2.2.2
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.29.0
Libc version: N/A

Python version: 3.11.8 (main, Apr 4 2024, 20:29:28) [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 M3 Max

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

cc @kulinseth @albanD @malfet @DenisVieriu97 @jhavukainen

@zou3519 zou3519 added triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module module: mps Related to Apple Metal Performance Shaders framework labels Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: mps Related to Apple Metal Performance Shaders framework triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants