pytorch
0a677f23 - [MPS] Add testcase for copying cpu tensors into strided mps tensors (#91784)

Commit
2 years ago
[MPS] Add testcase for copying cpu tensors into strided mps tensors (#91784) Fixes https://github.com/pytorch/pytorch/issues/86975 If the destination is a strided MPS tensor and the source is a CPU tensor, we cannot perform a blit directly to copy the memory from the CPU tensor into the MPS tensor. We need to scatter the data into the right indices. ``` a1 = torch.Tensor([[1,2],[3,4], [5,6]]).to(torch.device("mps")) b1 = torch.Tensor([-1, -1]) a1[1:,1] = b1 # strided MPS destination / contiguous CPU source ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/91784 Approved by: https://github.com/kulinseth
Author
Committer
Parents
Loading