microsoft / microsoft/onnxruntime
[Feature Request] C-API: Implement KernelInfoGetAttribute for all possible attribute types
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
Describe the feature request
The current C-API only offers the following functions for loading attributes:
KernelInfoGetAttribute_floatKernelInfoGetAttribute_int64KernelInfoGetAttribute_stringKernelInfoGetAttributeArray_floatKernelInfoGetAttributeArray_int64KernelInfoGetAttribute_tensor
The standard allows the following types:
enum AttributeType {
UNDEFINED = 0;
FLOAT = 1;
INT = 2;
STRING = 3;
TENSOR = 4;
GRAPH = 5;
SPARSE_TENSOR = 11;
TYPE_PROTO = 13;
FLOATS = 6;
INTS = 7;
STRINGS = 8;
TENSORS = 9;
GRAPHS = 10;
SPARSE_TENSORS = 12;
TYPE_PROTOS = 14;
}
The following functions are therefore missing from the C-API and should be added:
KernelInfoGetAttribute_graphKernelInfoGetAttribute_sparse_tensorKernelInfoGetAttribute_type_protoKernelInfoGetAttributeArray_stringKernelInfoGetAttributeArray_tensorKernelInfoGetAttributeArray_graphKernelInfoGetAttributeArray_sparse_tensorsKernelInfoGetAttributeArray_type_protoKernelInfoGetAttribute_undefined(?)
Describe scenario use case
Several of the above attribute types are used in the standard. Others might be useful to C-API authors precisely because the operator that would use them is not in the standard. Either way, it is an unfortunate surprise for C-API users to find out that the API does not support an attribute type they were planning to use.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing KernelInfoGetAttribute_* C-API functions and the linked ONNX AttributeType definition. Map the listed scalar and array attribute types to corresponding API functions, resolve whether UNDEFINED needs support, and verify that all standard types are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100