Check if pytorch is using metal on macbook

Hi Experts

Saw the news regarding pytorch to use Metal as backend:

My question is if there is a way (command), so can check that pytorch is using the new backend?

Thanks
sojohan

You need to install a nightly, it’s not released yet.
Then you can try this simple example:
https://pytorch.org/docs/master/notes/mps.html

Be aware that many ops are not implemented yet, it’s definitely alpha status!

Thanks Peter for quick reply.

I did install the preview (nightly) build and then I tried your script and got:

print(torch.backends.mps.is_built())
FALSE

print(torch.backends.mps.is_available())
FALSE

My macbook is new and runs mac os 12.3.1 and I can see that metal is installed.

Do you know how solve this?
Thanks Sojohan

Are you in an arm64 native python environment? or emulated x86?
You need to ensure you’re using an arm64 (apple silicon m1) native python environment.
The easiest IMO is to use conda-forge to get setup:

(this is also encouraged by Apple for getting tensorflow-metal working).