-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
implemented getOutputElementType #25657
Conversation
hey @Pey-crypto there is a conflict to solve, will you have a time to fix it, please? |
Will do it soon👍 |
awesome, thank you in advance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please apply suggestions and update tests, but it looks fine
/** | ||
* @brief Helper function to access model output elements types. | ||
* @return Napi::String representing the element type of the requested output. | ||
*/ | ||
|
||
Napi::Value get_output_element_type(const Napi::CallbackInfo& info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* @brief Helper function to access model output elements types. | |
* @return Napi::String representing the element type of the requested output. | |
*/ | |
Napi::Value get_output_element_type(const Napi::CallbackInfo& info); | |
/** | |
* @brief Helper function to access model output elements types. | |
* @return Napi::String representing the element type of the requested output. | |
*/ | |
Napi::Value get_output_element_type(const Napi::CallbackInfo& info); |
src/bindings/js/node/lib/addon.ts
Outdated
* It gets the input of the model. | ||
* If a model has more than one input, this method throws an exception. | ||
*/ | ||
getOutputElementType(index: number): string; | ||
/** | ||
* It gets the element type of a specific output of the model. | ||
*/ | ||
input(): Output; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* It gets the input of the model. | |
* If a model has more than one input, this method throws an exception. | |
*/ | |
getOutputElementType(index: number): string; | |
/** | |
* It gets the element type of a specific output of the model. | |
*/ | |
input(): Output; | |
* It gets the element type of a specific output of the model. | |
* @param index The index of the output. | |
*/ | |
getOutputElementType(index: number): string; | |
/** | |
* It gets the input of the model. | |
* If a model has more than one input, this method throws an exception. | |
*/ | |
input(): Output; |
Typedoc comments have to be above the method you are adding
reportError(info.Env(), e.what()); | ||
return info.Env().Undefined(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
/^Error:/, | ||
'Should throw for out-of-range index' | ||
); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}); | |
}); | |
#include "node/include/addon.hpp" | ||
#include "node/include/errors.hpp" | ||
#include "node/include/helper.hpp" | ||
#include "node/include/model_wrap.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change and move #include "node/include/model_wrap.hpp"
to the top.
Probably you are using a different formatting tool than is specified here
auto output = _model->output(idx); | ||
return cpp_to_js<ov::element::Type_t, Napi::String>(info, output.get_element_type()); | ||
} else { | ||
OPENVINO_THROW("getOutputElementType", ov::js::get_parameters_error_msg(info, allowed_signatures)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPENVINO_THROW("getOutputElementType", ov::js::get_parameters_error_msg(info, allowed_signatures)); | |
OPENVINO_THROW("'getOutputElementType'", ov::js::get_parameters_error_msg(info, allowed_signatures)); |
it('should accept a single integer argument', () => { | ||
assert.throws(() => { | ||
model.getOutputElementType(); | ||
}, /^Error: getOutputElementType method called with incorrect parameters\./, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to update error messages ;)
|
||
assert.throws(() => { | ||
model.getOutputElementType('unexpected argument'); | ||
}, /^Error: getOutputElementType method called with incorrect parameters\./, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
|
||
assert.throws(() => { | ||
model.getOutputElementType(0, 1); | ||
}, /^Error: getOutputElementType method called with incorrect parameters\./, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
|
||
assert.throws(() => { | ||
model.getOutputElementType(3.14); | ||
}, /^Error: getOutputElementType method called with incorrect parameters\./, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
118807c
to
3056b53
Compare
Implemented Method on c++ side.
Updated typescript definitions.
Created unit tests.
For Issue #25406