File tree Expand file tree Collapse file tree 7 files changed +17
-1
lines changed
Expand file tree Collapse file tree 7 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,7 @@ struct ProviderHost {
390390 virtual void AttributeProto__set_name (ONNX_NAMESPACE::AttributeProto* p, const ::std::string& value) = 0;
391391 virtual void AttributeProto__set_type (ONNX_NAMESPACE::AttributeProto* p, ONNX_NAMESPACE::AttributeProto_AttributeType value) = 0;
392392 virtual ONNX_NAMESPACE::TensorProto* AttributeProto__add_tensors (ONNX_NAMESPACE::AttributeProto* p) = 0;
393+ virtual std::string* AttributeProto__release_s (ONNX_NAMESPACE::AttributeProto* p) = 0;
393394
394395 // GraphProto
395396 virtual std::unique_ptr<ONNX_NAMESPACE::GraphProto> GraphProto__construct () = 0;
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ struct AttributeProto final {
122122 void set_name (const ::std::string& value) { return g_host->AttributeProto__set_name (this , value); }
123123 void set_type (AttributeProto_AttributeType value) { return g_host->AttributeProto__set_type (this , value); }
124124 TensorProto* add_tensors () { return g_host->AttributeProto__add_tensors (this ); }
125+ std::string* release_s () { return g_host->AttributeProto__release_s (this ); }
125126
126127 typedef AttributeProto_AttributeType AttributeType;
127128 static constexpr AttributeType UNDEFINED = AttributeProto_AttributeType_UNDEFINED;
Original file line number Diff line number Diff line change @@ -104,4 +104,8 @@ std::vector<std::string> attr_proto_get_strings(const ONNX_NAMESPACE::AttributeP
104104 }
105105 return ret;
106106}
107+ std::string* attr_proto_release_string (ONNX_NAMESPACE::AttributeProto* attr) {
108+ vai_assert (attr->type () == ONNX_NAMESPACE::AttributeProto_AttributeType_STRING, attr->name ());
109+ return attr->release_s ();
110+ }
107111} // namespace vaip
Original file line number Diff line number Diff line change @@ -23,5 +23,6 @@ const ONNX_NAMESPACE::TensorProto& attr_proto_get_tensor(const ONNX_NAMESPACE::A
2323gsl::span<const int64_t > attr_proto_get_ints (const ONNX_NAMESPACE::AttributeProto& attr);
2424gsl::span<const float > attr_proto_get_floats (const ONNX_NAMESPACE::AttributeProto& attr);
2525std::vector<std::string> attr_proto_get_strings (const ONNX_NAMESPACE::AttributeProto& attr);
26+ std::string* attr_proto_release_string (ONNX_NAMESPACE::AttributeProto* attr);
2627
2728} // namespace vaip
Original file line number Diff line number Diff line change @@ -449,6 +449,13 @@ vaip_core::OrtApiForVaip* create_org_api_hook() {
449449 return vaip_core::DllSafe (model_proto.SerializeAsString ());
450450 };
451451 the_global_api.model_proto_delete = [](ONNX_NAMESPACE::ModelProto* p) { delete p; };
452+ the_global_api.attr_proto_release_string = [](ONNX_NAMESPACE::AttributeProto* attr) -> vaip_core::DllSafe<std::string> {
453+ auto pstr = vaip::attr_proto_release_string (attr);
454+ std::string local_str = std::move (*pstr);
455+ pstr = nullptr ;
456+ return vaip_core::DllSafe<std::string>(std::move (local_str));
457+ };
458+
452459 if (!s_library_vitisaiep.vaip_get_version ) {
453460 return reinterpret_cast <vaip_core::OrtApiForVaip*>(&(the_global_api.host_ ));
454461 } else {
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ struct OrtApi;
1313
1414namespace vaip_core {
1515
16- #define VAIP_ORT_API_MAJOR (11u )
16+ #define VAIP_ORT_API_MAJOR (12u )
1717#define VAIP_ORT_API_MINOR (0u )
1818#define VAIP_ORT_API_PATCH (0u )
1919struct OrtApiForVaip {
@@ -234,6 +234,7 @@ struct OrtApiForVaip {
234234 ModelProto* (*model_to_proto)(Model& model); // [95]
235235 DllSafe<std::string> (*model_proto_serialize_as_string)(ModelProto& model_proto); // [96]
236236 void (*model_proto_delete)(ModelProto* p); // [97]
237+ DllSafe<std::string> (*attr_proto_release_string)(AttributeProto* attr); // [98]
237238};
238239
239240#ifndef USE_VITISAI
Original file line number Diff line number Diff line change @@ -497,6 +497,7 @@ struct ProviderHostImpl : ProviderHost {
497497 void AttributeProto__set_name (ONNX_NAMESPACE::AttributeProto* p, const ::std::string& value) override { return p->set_name (value); }
498498 void AttributeProto__set_type (ONNX_NAMESPACE::AttributeProto* p, ONNX_NAMESPACE::AttributeProto_AttributeType value) override { return p->set_type (value); }
499499 ONNX_NAMESPACE::TensorProto* AttributeProto__add_tensors (ONNX_NAMESPACE::AttributeProto* p) override { return p->add_tensors (); }
500+ std::string* AttributeProto__release_s (ONNX_NAMESPACE::AttributeProto* p) override { return p->release_s (); }
500501
501502 // GraphProto (wrapped)
502503 std::unique_ptr<ONNX_NAMESPACE::GraphProto> GraphProto__construct () override { return std::make_unique<ONNX_NAMESPACE::GraphProto>(); }
You can’t perform that action at this time.
0 commit comments