Thanks for your comment, Liting Chen.
There is an open issue about this in TensorFlow MacOS.
Citing the most important answer in the issue:
Currently, we not have support for the tf.config.list_physical_devices() API. There is an optional mlcompute.set_mlc_device(device_name=’any') API for ML Compute device selection. The default value for device_name is 'any’, which means ML Compute will select the best available device on your system, including multiple GPUs on multi-GPU configurations. Other available options are ‘cpu’ and ‘gpu’. Please see the Device Selection and the Logging and Debugging sections of the README for more information. If you turn on logging, you can see which device(s) ML Compute is using.
I hope this clarifies it for you.
Here you can find the issue: