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?


You need to install a nightly, it’s not released yet.
Then you can try this simple example:

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:



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).