Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Experimental API for setting model name #10518

Merged
merged 8 commits into from
Feb 25, 2022

Conversation

nums11
Copy link
Contributor

@nums11 nums11 commented Feb 10, 2022

This change adds the SetName function to the LearningModelExperimental API

  • Setting the model name will allow easier tracking of which models are in use through telemetry
  • A test for the function is added to the LearningModelSessionAPTest

@nums11 nums11 requested a review from smk2007 February 10, 2022 21:20
@nums11 nums11 changed the title Add Experimental API for editing model name Add Experimental API for setting model name Feb 11, 2022
@@ -66,6 +66,9 @@ IModelInfo : IUnknown {
STDMETHOD(GetName)
(const char** out, size_t* len) PURE;

STDMETHOD(SetName)
(const char* name) PURE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the convention that we expect the char* to be null terminated and therefore we don't need to pass the length?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I assume the char* will be null terminated

ORT_API_STATUS_IMPL(winmla::ModelSetName, _In_ const OrtModel* model, _In_ const char* const name) {
API_IMPL_BEGIN
auto model_proto = model->UseModelProto();
ONNX_NAMESPACE::GraphProto& graph = *model_proto->mutable_graph();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the "mutable_graph()" call return null?

@@ -279,6 +279,13 @@ LearningModel::OutputFeatures() try {
}
WINML_CATCH_ALL

void LearningModel::SetName(const hstring& name) try {
auto name_std_str = _winml::Strings::UTF8FromHString(name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this return when you pass in something that can't be represented in char*? like a wide-unicode character

martinb35
martinb35 previously approved these changes Feb 24, 2022
martinb35
martinb35 previously approved these changes Feb 25, 2022
smk2007
smk2007 previously approved these changes Feb 25, 2022
@nums11 nums11 dismissed stale reviews from smk2007 and martinb35 via be7245e February 25, 2022 19:07
@nums11 nums11 merged commit 5fbfca3 into master Feb 25, 2022
@nums11 nums11 deleted the user/numform/edit_model_name_impl branch February 25, 2022 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants