---
title: utils.autodevice API Reference
description: Discover how to automatically select the most idle GPU using PyTorch and NVIDIA (nvidia-ml-py) with this AutoDevice script. Ideal for optimizing GPU usage in deep learning and computer vision tasks.
keywords: Ultralytics, AutoDevice, GPU selection, PyTorch, NVML, pynvml, GPU monitoring, CUDA, deep learning, idle GPU, memory utilization, temperature, power usage
---

# Reference for `ultralytics/utils/autodevice.py`

!!! success "Improvements"

    This page is sourced from [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/utils/autodevice.py](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/utils/autodevice.py). Have an improvement or example to add? Open a [Pull Request](https://docs.ultralytics.com/help/contributing) — thank you! 🙏

<br>

## ::: ultralytics.utils.autodevice.GPUInfo

<br><br>
