From 596e0320f3425db364945895267402c895d1adb7 Mon Sep 17 00:00:00 2001 From: Vincent Demoulin Date: Fri, 22 Nov 2024 09:55:52 +0100 Subject: [PATCH] bugfix in terminate function --- src/aliceVision/segmentation/segmentation.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/aliceVision/segmentation/segmentation.cpp b/src/aliceVision/segmentation/segmentation.cpp index 213b68b023..07d9cccaa0 100644 --- a/src/aliceVision/segmentation/segmentation.cpp +++ b/src/aliceVision/segmentation/segmentation.cpp @@ -89,11 +89,14 @@ bool Segmentation::initialize() bool Segmentation::terminate() { + if (_parameters.useGpu) + { #if ALICEVISION_IS_DEFINED(ALICEVISION_HAVE_ONNX_GPU) - Ort::MemoryInfo mem_info_cuda("Cuda", OrtAllocatorType::OrtArenaAllocator, 0, OrtMemType::OrtMemTypeDefault); - Ort::Allocator cudaAllocator(*_ortSession, mem_info_cuda); - cudaAllocator.Free(_cudaInput); + Ort::MemoryInfo mem_info_cuda("Cuda", OrtAllocatorType::OrtArenaAllocator, 0, OrtMemType::OrtMemTypeDefault); + Ort::Allocator cudaAllocator(*_ortSession, mem_info_cuda); + cudaAllocator.Free(_cudaInput); #endif + } return true; }