pytorch-deep-learning icon indicating copy to clipboard operation
pytorch-deep-learning copied to clipboard

Warning on MPS backends

Open benhour opened this issue 1 year ago • 1 comments

Dear All,

I am running PyTorch on MacBook Pro M2 Max and I am getting the following warning: “”" UserWarning: The operator ‘aten::nonzero’ is not currently supported on the MPS backend and will fall back to run on the CPU. This may have performance implications. (Triggered internally at /Users/runner/work/pytorch/pytorch/pytorch/aten/src/ATen/mps/MPSFallback.mm:11.) nonzero_finite_vals = torch.masked_select( “”" I am afraid that I am not able to use the full potential of MPS on my system. I should state that I followed the installation process given by Daniel. I appreciate your help regarding this issue.

Bests, Benhour

benhour avatar Mar 17 '23 18:03 benhour

Hello There,

I had similar issue. Seems that MPS does not support all the operations.

A work around is to move the tensors to the CPU

Example.


if compute_device == torch.device("mps"):
    acc = acc_fn(pred_classes.to("cpu"), label_batch.to("cpu"))
    print(acc)

Hope this helps

Thanks.

vineetsharma14 avatar Mar 31 '23 13:03 vineetsharma14