Category: Solution

A PyTorch GPU Memory Leak Example

I ran into this GPU memory leak issue when building a PyTorch training pipeline. After spending quite some time, I finally figured out this minimal reproducible example. Kicking off the training, it shows constantly increasing allocated GPU memory. This “AverageMeter” has been used in many popular repositories (e.g., https://github.com/facebookresearch/moco). It’s by-design tracking the average of

Header-only JPEG Save/Load

部署项目的时候偶尔会遇到这类需求,不能使用OpenCV之类的库来读写图片,比如需要部署到嵌入式环境之类的。网上找了一阵,发现对于jpeg的读写,这两个库很方便。