"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "7186bb45f00adb36a880bd30d41cfddb12faae11"
Unverified Commit 6db54fb7 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Make nvjpeg handle creation once_flag static (#5713)

parent 88aaf51e
...@@ -71,7 +71,7 @@ torch::Tensor decode_jpeg_cuda( ...@@ -71,7 +71,7 @@ torch::Tensor decode_jpeg_cuda(
at::cuda::CUDAGuard device_guard(device); at::cuda::CUDAGuard device_guard(device);
// Create global nvJPEG handle // Create global nvJPEG handle
std::once_flag nvjpeg_handle_creation_flag; static std::once_flag nvjpeg_handle_creation_flag;
std::call_once(nvjpeg_handle_creation_flag, []() { std::call_once(nvjpeg_handle_creation_flag, []() {
if (nvjpeg_handle == nullptr) { if (nvjpeg_handle == nullptr) {
nvjpegStatus_t create_status = nvjpegCreateSimple(&nvjpeg_handle); nvjpegStatus_t create_status = nvjpegCreateSimple(&nvjpeg_handle);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment