diff options
author | Arne Juul <arnej@yahooinc.com> | 2022-12-02 14:10:52 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahooinc.com> | 2022-12-02 14:10:52 +0000 |
commit | 26c99edbfd8ee2c53f9a2448e8c680e09b1cb235 (patch) | |
tree | 57a674e3620aaf646507502df7392a6031fe934c /eval | |
parent | c956ac4cb73b329243072aabe35f0da508c02d0f (diff) |
session.GetOutputName is deprecated
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/vespa/eval/onnx/onnx_wrapper.cpp | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/eval/src/vespa/eval/onnx/onnx_wrapper.cpp b/eval/src/vespa/eval/onnx/onnx_wrapper.cpp index ed38a385d25..7b2de4dfaa1 100644 --- a/eval/src/vespa/eval/onnx/onnx_wrapper.cpp +++ b/eval/src/vespa/eval/onnx/onnx_wrapper.cpp @@ -166,33 +166,20 @@ Onnx::ElementType make_element_type(ONNXTensorElementDataType element_type) { class OnnxString { private: static Ort::AllocatorWithDefaultOptions _alloc; - char *_str; - void cleanup() { - if (_str != nullptr) { - _alloc.Free(_str); - _str = nullptr; - } - } - OnnxString(char *str) : _str(str) {} + Ort::AllocatedStringPtr _str; + OnnxString(Ort::AllocatedStringPtr str) : _str(std::move(str)) {} public: OnnxString(const OnnxString &rhs) = delete; OnnxString &operator=(const OnnxString &rhs) = delete; - OnnxString(OnnxString &&rhs) : _str(rhs._str) { - rhs._str = nullptr; - } - OnnxString &operator=(OnnxString &&rhs) { - cleanup(); - _str = rhs._str; - rhs._str = nullptr; - return *this; - } - const char *get() const { return _str; } - ~OnnxString() { cleanup(); } + OnnxString(OnnxString &&rhs) = default; + OnnxString &operator=(OnnxString &&rhs) = default; + const char *get() const { return _str.get(); } + ~OnnxString() = default; static OnnxString get_input_name(const Ort::Session &session, size_t idx) { - return OnnxString(session.GetInputName(idx, _alloc)); + return OnnxString(session.GetInputNameAllocated(idx, _alloc)); } static OnnxString get_output_name(const Ort::Session &session, size_t idx) { - return OnnxString(session.GetOutputName(idx, _alloc)); + return OnnxString(session.GetOutputNameAllocated(idx, _alloc)); } }; Ort::AllocatorWithDefaultOptions OnnxString::_alloc; |