mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-09 17:28:58 +00:00
17 lines
547 B
C++
17 lines
547 B
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#pragma once
|
|
|
|
#include "core/session/onnxruntime_c_api.h"
|
|
|
|
namespace onnxruntime {
|
|
#if defined(USE_TENSORRT) || defined(USE_CUDA)
|
|
static char* StrDup(const std::string& str, _Inout_ OrtAllocator* allocator) {
|
|
char* output_string = reinterpret_cast<char*>(allocator->Alloc(allocator, str.size() + 1));
|
|
memcpy(output_string, str.c_str(), str.size());
|
|
output_string[str.size()] = '\0';
|
|
return output_string;
|
|
}
|
|
#endif
|
|
} // namespace onnxruntime
|