Skip to content

Commit

Permalink
Last linux build error fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
skottmckay committed Dec 23, 2024
1 parent 5e85fce commit 275f762
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/onnxruntime/core/session/onnxruntime_cxx_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -2571,7 +2571,7 @@ struct ValueInfo : detail::ValueInfoImpl<OrtValueInfo> {
explicit ValueInfo(OrtValueInfo* p) : ValueInfoImpl<OrtValueInfo>{p} {}

// Create ValueInfo for a tensor
explicit ValueInfo(const std::string& name, ConstTypeInfo& type_info);
explicit ValueInfo(const std::string& name, const ConstTypeInfo& type_info);

ConstValueInfo GetConst() const { return ConstValueInfo{this->p_}; }
};
Expand Down
3 changes: 2 additions & 1 deletion include/onnxruntime/core/session/onnxruntime_cxx_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -2396,7 +2396,7 @@ inline Model::Model(const std::vector<DomainOpsetPair>& opsets) {
ThrowOnError(GetModelBuilderApi().CreateModel(domains.data(), versions.data(), opsets.size(), &p_));
}

inline ValueInfo::ValueInfo(const std::string& name, ConstTypeInfo& type_info) {
inline ValueInfo::ValueInfo(const std::string& name, const ConstTypeInfo& type_info) {
ThrowOnError(GetModelBuilderApi().CreateValueInfo(name.c_str(), type_info, &p_));
}
namespace detail {
Expand Down Expand Up @@ -2454,6 +2454,7 @@ inline void GraphImpl<OrtGraph>::AddNode(Node& node) {
ThrowOnError(GetModelBuilderApi().AddNodeToGraph(p_, node.release()));
}

template <>
inline void ModelImpl<OrtModel>::AddGraph(Graph& graph) {
// Model takes ownership of `graph`
ThrowOnError(GetModelBuilderApi().AddGraphToModel(p_, graph.release()));
Expand Down
6 changes: 3 additions & 3 deletions onnxruntime/test/shared_lib/test_model_builder_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@ struct TestAllocator : public OrtAllocator {
auto it = std::find_if(test_allocator->weights.begin(), test_allocator->weights.end(),
[p](const std::unique_ptr<std::vector<float>>& v) { return v->data() == p; });
if (it == test_allocator->weights.end()) {
throw std::exception("Free called with unknown pointer");
throw std::runtime_error("Free called with unknown pointer");
}

test_allocator->weights.erase(it);
};

Alloc = [](struct OrtAllocator* /*this*/, size_t /*size*/) -> void* {
throw std::exception("This should not be used");
throw std::runtime_error("This should not be used");
};

Reserve = [](struct OrtAllocator* /*this*/, size_t /*size*/) -> void* {
throw std::exception("This should not be used");
throw std::runtime_error("This should not be used");
};
}

Expand Down
2 changes: 2 additions & 0 deletions onnxruntime/test/shared_lib/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include "core/session/onnxruntime_cxx_api.h"

#include "gtest/gtest.h"

OrtCUDAProviderOptions CreateDefaultOrtCudaProviderOptionsWithCustomStream(void* cuda_compute_stream = nullptr);

template <typename T = float>
Expand Down

0 comments on commit 275f762

Please sign in to comment.