You installed TensorFlow on your AI laptop, ran your first model, and it either crawls on the CPU, reports no GPU, or crashes with a DirectML error. TensorFlow on Windows laptops does not use CUDA the way it does on NVIDIA desktops — it uses TensorFlow-DirectML, a separate plugin with its own version rules, and getting those rules wrong produces exactly these symptoms.
The fix is almost always environmental: the right package, the right Python version, the right driver, and a clean virtual environment. This guide works through that environment in order, then covers the runtime errors that remain after setup is correct.
Why this happens
- TensorFlow-DirectML plugin missing: Installing plain TensorFlow on Windows does not include GPU support. Without the DirectML plugin package, TensorFlow silently runs on CPU.
- Version mismatch between Python, TensorFlow, and the plugin: The DirectML plugin supports specific TensorFlow and Python version combinations. A mismatch can install cleanly and then fail at runtime.
- Outdated graphics driver: DirectML device detection depends on the GPU driver. A stale driver can hide the GPU from TensorFlow entirely.
- Wrong virtual environment activated: Installing the plugin in one environment and running code in another is an easy mistake that produces a “no GPU” result.
- Conflicting packages in a shared environment: Mixing CUDA TensorFlow, CPU TensorFlow, and DirectML packages in one environment creates import conflicts that break GPU detection.
- Model operations unsupported by DirectML: A small set of TensorFlow operations lack DirectML kernels and fall back to CPU or error, which looks like a setup failure for specific models.
How to fix it
Work through these in order — diagnose first, then act.
Fix 1: Create a clean virtual environment with the right versions
A fresh environment eliminates the entire class of conflict problems. Do not try to repair a mixed environment first.
- Install a Python version that your chosen TensorFlow-DirectML release supports — check the plugin’s documentation for the exact range.
- Create a new virtual environment and activate it before installing anything.
- Install TensorFlow and the TensorFlow-DirectML plugin in that environment, following the plugin’s installation guide exactly.
- Verify the environment is the one running your code by printing the Python executable path from your script.
- Run a minimal GPU check script that lists physical devices — it should show a DirectML GPU device, not just CPU. If it shows only CPU, continue to the driver fix.
Fix 2: Update the graphics driver
DirectML cannot see a GPU that the driver does not expose properly. Driver repair is the second step because it is quick and frequently the real cause.
- Identify your GPU in Device Manager under Display adapters.
- Download the latest graphics driver from your laptop maker’s support page or Intel’s driver detection tool for Intel graphics.
- Install the driver and restart.
- Re-run the GPU device check from Fix 1 — the DirectML device should now appear.
- If it still does not, confirm DirectX 12 is working by running
dxdiagand checking the Display tab for errors. Related DirectML device issues also affect Stable Diffusion DirectML setups .
Fix 3: Verify the plugin import and device placement
Sometimes the plugin is installed but code never places work on the GPU. Explicit device placement separates installation problems from code problems.
- In your script, list physical devices and print them before building any model.
- If a GPU device appears, wrap your model code in a device placement block targeting the GPU.
- Run a tiny training step and watch GPU usage in Task Manager’s Performance tab — activity confirms the GPU is engaged.
- If GPU usage stays at zero despite a listed device, check for a device placement error in the logs.
- If no GPU device is listed at all, return to Fix 1 and verify the plugin package actually installed in the active environment.
Fix 4: Resolve version conflicts and import errors
Import errors with names like “cannot import” or “DLL load failed” almost always mean a version conflict in the environment.
- List installed packages with
pip listand compare TensorFlow, plugin, and Python versions against the plugin’s compatibility table. - Uninstall conflicting packages — especially any CUDA TensorFlow build — from the environment.
- Reinstall the exact versions the plugin documents, in a fresh environment if the conflict is tangled.
- Test the import again with a minimal script before running your full model.
- Record the working version combination so future installs reproduce it.
Fix 5: Handle unsupported operations and slow models
A model that trains on GPU but crawls or errors on specific layers may hit DirectML’s operation coverage limits rather than a setup problem.
- Read the error or warning for the specific operation name that failed or fell back to CPU.
- Check the DirectML operation support documentation for that operation.
- Replace or restructure the unsupported layer if the model design allows it.
- Reduce batch size and model size for a test run to separate memory limits from operation limits.
- If the model fundamentally needs CUDA-only operations, run it on a cloud GPU or a CUDA machine instead of forcing it through DirectML.
Fix 6: Optimize performance and keep the setup stable
Once GPU execution works, tuning and stability keep it working across updates.
- Set memory growth options so TensorFlow does not allocate all GPU memory at startup and starve other apps.
- Use mixed precision where your model supports it for a speed gain on integrated GPUs.
- Pin your working package versions in a requirements file.
- Avoid updating TensorFlow or the plugin mid-project — update between projects, then re-verify GPU detection.
- For further Windows ML guidance, see Microsoft’s Windows support pages . Related local-AI topics include Fooocus install fixes and Perplexity on ARM .
Closing
TensorFlow on an AI laptop works through TensorFlow-DirectML, and its failures are nearly always environmental: a missing plugin, a version mismatch, a stale driver, or the wrong virtual environment. Build a clean environment with documented versions, update the graphics driver, and verify GPU detection with a minimal script before running real models. Once that baseline works, DirectML GPU execution is stable and predictable. If this fix did not fully resolve the issue, related troubleshooting for Asus Vivobook S 16 Ai Issues and Click To Do Image Actions Not Working covers neighboring causes that can produce the same symptom on AI laptops.
