File tree 7 files changed +17
-1
lines changed
7 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,7 @@ struct ProviderHost {
390
390
virtual void AttributeProto__set_name (ONNX_NAMESPACE::AttributeProto* p, const ::std::string& value) = 0;
391
391
virtual void AttributeProto__set_type (ONNX_NAMESPACE::AttributeProto* p, ONNX_NAMESPACE::AttributeProto_AttributeType value) = 0;
392
392
virtual ONNX_NAMESPACE::TensorProto* AttributeProto__add_tensors (ONNX_NAMESPACE::AttributeProto* p) = 0;
393
+ virtual std::string* AttributeProto__release_s (ONNX_NAMESPACE::AttributeProto* p) = 0;
393
394
394
395
// GraphProto
395
396
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 {
122
122
void set_name (const ::std::string& value) { return g_host->AttributeProto__set_name (this , value); }
123
123
void set_type (AttributeProto_AttributeType value) { return g_host->AttributeProto__set_type (this , value); }
124
124
TensorProto* add_tensors () { return g_host->AttributeProto__add_tensors (this ); }
125
+ std::string* release_s () { return g_host->AttributeProto__release_s (this ); }
125
126
126
127
typedef AttributeProto_AttributeType AttributeType;
127
128
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
104
104
}
105
105
return ret;
106
106
}
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
+ }
107
111
} // 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
23
23
gsl::span<const int64_t > attr_proto_get_ints (const ONNX_NAMESPACE::AttributeProto& attr);
24
24
gsl::span<const float > attr_proto_get_floats (const ONNX_NAMESPACE::AttributeProto& attr);
25
25
std::vector<std::string> attr_proto_get_strings (const ONNX_NAMESPACE::AttributeProto& attr);
26
+ std::string* attr_proto_release_string (ONNX_NAMESPACE::AttributeProto* attr);
26
27
27
28
} // namespace vaip
Original file line number Diff line number Diff line change @@ -449,6 +449,13 @@ vaip_core::OrtApiForVaip* create_org_api_hook() {
449
449
return vaip_core::DllSafe (model_proto.SerializeAsString ());
450
450
};
451
451
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
+
452
459
if (!s_library_vitisaiep.vaip_get_version ) {
453
460
return reinterpret_cast <vaip_core::OrtApiForVaip*>(&(the_global_api.host_ ));
454
461
} else {
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ struct OrtApi;
13
13
14
14
namespace vaip_core {
15
15
16
- #define VAIP_ORT_API_MAJOR (11u )
16
+ #define VAIP_ORT_API_MAJOR (12u )
17
17
#define VAIP_ORT_API_MINOR (0u )
18
18
#define VAIP_ORT_API_PATCH (0u )
19
19
struct OrtApiForVaip {
@@ -234,6 +234,7 @@ struct OrtApiForVaip {
234
234
ModelProto* (*model_to_proto)(Model& model); // [95]
235
235
DllSafe<std::string> (*model_proto_serialize_as_string)(ModelProto& model_proto); // [96]
236
236
void (*model_proto_delete)(ModelProto* p); // [97]
237
+ DllSafe<std::string> (*attr_proto_release_string)(AttributeProto* attr); // [98]
237
238
};
238
239
239
240
#ifndef USE_VITISAI
Original file line number Diff line number Diff line change @@ -497,6 +497,7 @@ struct ProviderHostImpl : ProviderHost {
497
497
void AttributeProto__set_name (ONNX_NAMESPACE::AttributeProto* p, const ::std::string& value) override { return p->set_name (value); }
498
498
void AttributeProto__set_type (ONNX_NAMESPACE::AttributeProto* p, ONNX_NAMESPACE::AttributeProto_AttributeType value) override { return p->set_type (value); }
499
499
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 (); }
500
501
501
502
// GraphProto (wrapped)
502
503
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