microsoft / microsoft/onnxruntime

ORT Custom op APIs support get vector<string> type attributes of a node [Feature Request]

Open
#18,911 0 comments 0 reactions 0 assignees View on GitHub
api feature request
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the feature request

I am working at adding more custom ops with onnxruntime custom OrtApis.

Now we have a node with vector string type attributes but it seems that there is not any apis I can use to access this kind of attributes. I have been scan the onnxruntime_c_api.h file. it seems that we can only access the following 5 kind of attributes in a custom node:

```
float; int; string; vector; vector

by the following APi like:
ORT_API2_STATUS(KernelInfoGetAttributeArray_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
_Out_ float* out, _Inout_ size_t* size);
ORT_API2_STATUS(KernelInfoGetAttributeArray_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
_Out_ int64_t* out, _Inout_ size_t* size);

ORT_API2_STATUS(KernelInfoGetAttribute_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
_Out_ float* out);
ORT_API2_STATUS(KernelInfoGetAttribute_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
_Out_ int64_t* out);
ORT_API2_STATUS(KernelInfoGetAttribute_string, _In_ const OrtKernelInfo* info, _In_ const char* name, _Out_ char* out,
_Inout_ size_t* size);

```

### Describe scenario use case

what I really want is an custom Ort api to access vector attribute in a node, this api might be like:

```
ORT_API2_STATUS(KernelInfoGetAttributeArray_string, _In_ const OrtKernelInfo* info, _In_ const char* name,
_Out_ int64_t* out, _Inout_ size_t* size);
```

Contributor guide

Open the contributing guide

Research direction

Start with onnxruntime_c_api.h and the existing KernelInfoGetAttribute_* and KernelInfoGetAttributeArray_* declarations. Trace how custom-op node attributes are exposed through these APIs, then define support for vector attributes and verify that the public API and its behavior are consistent with the existing attribute accessors.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
ai, api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.