-
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
[ONNX] Added translation for string constants/inputs #24189
Conversation
FRONT_END_THROW("Loading strings from raw data isn't supported"); | ||
} | ||
if (m_tensor_proto->data_type() == TensorProto_DataType::TensorProto_DataType_STRING) { | ||
return std::vector<std::string>(m_tensor_proto->string_data().begin(), m_tensor_proto->string_data().end()); |
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.
can we use detail::__get_data
? Is it already string objects in memory? can we create view tensor on it without recreation string objects?
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.
I don't see an easy way to perform it without copying, and it isn't a purpose of this PR.
As I can see, when string is stored in a memory (disk or ram) - it isn't represented as a C-string. It looks like a bytes without an ending zero.
Sounds like you are talking about usage of std::string_view. If nothing changed - we haven't moved to C++17 standard yet. Moreover, I have some concerns string_view actually will solve the pointed issue, I don't remember I saw a code which allows to use string_view in constants in the core.
So, I think I'm obligated to use this approach to get strings from a protobuf format...
test_case.add_input<std::string>({"strinpt1", "strinpt2"}); | ||
test_case.add_expected_output<int64_t>({2}); | ||
test_case.add_expected_output<std::string>({"strinpt1", "strinpt2"}); |
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.
test_case.add_input<std::string>({"strinpt1", "strinpt2"}); | |
test_case.add_expected_output<int64_t>({2}); | |
test_case.add_expected_output<std::string>({"strinpt1", "strinpt2"}); | |
test_case.add_input<std::string>({"string1", "string2"}); | |
test_case.add_expected_output<int64_t>({2}); | |
test_case.add_expected_output<std::string>({"string1", "string2"}); |
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 was an original option and it was equal to string_constant test, I want to be sure we use correct model for testing.
…#24189) ### Details: - Added support for accepting string as inputs and constants ### Tickets: - 139685
Details:
Tickets: