---
description: Optimize your PyTorch models with Ultralytics YOLO's torch_utils functions such as ModelEMA, select_device, and is_parallel.
keywords: Ultralytics YOLO, Torch, Utils, Pytorch, Object Detection
---
## ModelEMA
---
### ::: ultralytics.yolo.utils.torch_utils.ModelEMA
## EarlyStopping
---
### ::: ultralytics.yolo.utils.torch_utils.EarlyStopping
## torch_distributed_zero_first
---
### ::: ultralytics.yolo.utils.torch_utils.torch_distributed_zero_first
## smart_inference_mode
---
### ::: ultralytics.yolo.utils.torch_utils.smart_inference_mode
## get_cpu_info
---
### ::: ultralytics.yolo.utils.torch_utils.get_cpu_info
## select_device
---
### ::: ultralytics.yolo.utils.torch_utils.select_device
## time_sync
---
### ::: ultralytics.yolo.utils.torch_utils.time_sync
## fuse_conv_and_bn
---
### ::: ultralytics.yolo.utils.torch_utils.fuse_conv_and_bn
## fuse_deconv_and_bn
---
### ::: ultralytics.yolo.utils.torch_utils.fuse_deconv_and_bn
## model_info
---
### ::: ultralytics.yolo.utils.torch_utils.model_info
## get_num_params
---
### ::: ultralytics.yolo.utils.torch_utils.get_num_params
## get_num_gradients
---
### ::: ultralytics.yolo.utils.torch_utils.get_num_gradients
## model_info_for_loggers
---
### ::: ultralytics.yolo.utils.torch_utils.model_info_for_loggers
## get_flops
---
### ::: ultralytics.yolo.utils.torch_utils.get_flops
## get_flops_with_torch_profiler
---
### ::: ultralytics.yolo.utils.torch_utils.get_flops_with_torch_profiler
## initialize_weights
---
### ::: ultralytics.yolo.utils.torch_utils.initialize_weights
## scale_img
---
### ::: ultralytics.yolo.utils.torch_utils.scale_img
## make_divisible
---
### ::: ultralytics.yolo.utils.torch_utils.make_divisible
## copy_attr
---
### ::: ultralytics.yolo.utils.torch_utils.copy_attr
## get_latest_opset
---
### ::: ultralytics.yolo.utils.torch_utils.get_latest_opset
## intersect_dicts
---
### ::: ultralytics.yolo.utils.torch_utils.intersect_dicts
## is_parallel
---
### ::: ultralytics.yolo.utils.torch_utils.is_parallel
## de_parallel
---
### ::: ultralytics.yolo.utils.torch_utils.de_parallel
## one_cycle
---
### ::: ultralytics.yolo.utils.torch_utils.one_cycle
## init_seeds
---
### ::: ultralytics.yolo.utils.torch_utils.init_seeds
## strip_optimizer
---
### ::: ultralytics.yolo.utils.torch_utils.strip_optimizer
## profile
---
### ::: ultralytics.yolo.utils.torch_utils.profile