I also have an M2 and I followed the same guide, but I haven't had this problem. I did find that the third line of the Arm64:Apple Silicon instruction led to something very peculiar when i tried to update to the latest version of Conda as recommended by Anaconda, effectively identifying everything in the system as "incompatible", so I deleted the whole Anaconda environment. Eventually I implemented the venv-metal virtual environment from the terminal from inside VSC as in the x86:AMD box, including installing a new version of Python, then the two tensorflow-macos and tensorflow-metal installs, and the test code then worked immediately. I have had no problems since, although probably I should say "yet"! I have never seen the "Failed to get CPU frequency" message on my machine. I've read in some posts that people have had bizarre errors when they've first installed a "vanilla-flavoured" non-Mac version of tensorflow that is sitting in the same venv; maybe you should check that you've only got the macos and metal versions?