微软为了改变办公操作系统的形象也是拼了,出了WSL支持原生虚拟linux系统,还为WSL做了多个优化,其中就包括提供TensorFlow在WSL下的GPU支持。
环境要求
Windows11 或者 Windows 10 (21H2版本以后)
WSL下的Linux,如Ubuntu或Debian
只支持 Python 3.5, 3.6, 3.7
安装最新的显卡驱动
AMD
Download and install AMD's driver
Intel
Download and install Intel's driver to use with DirectML from their website.
NVIDIA
Download and install NVIDIA's driver to use with DirectML from their website. For more information, see NVIDIA's GPU in Windows Subsystem for Linux (WSL) page.
安装
pip install tensorflow-directml
官方网站说只支持Tensorflow1.15,实测安装的已经到2.6了。应该是网站还没更新。