Android/fix evalue string serialization#17609
Conversation
toByteArray() used toString() (returning "EValue@...") instead of toStr(), and allocated the buffer using char count instead of byte count. fromByteArray() threw an exception for strings instead of deserializing them. Fix both directions using a length-prefixed format, and also fix the misleading "Unknown Tensor dtype" error message. Add round-trip tests for ASCII, empty, and Unicode strings.
Chinese (3-byte UTF-8) and emoji (4-byte UTF-8 + surrogate pairs) cover more encoding edge cases than Japanese hiragana alone.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/17609
Note: Links to docs will display an error until the docs builds have been completed. ❌ 4 New Failures, 1 Unrelated FailureAs of commit 8d18fec with merge base cf08087 ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
Summary
toByteArray() used toString() (returning "EValue@...") instead of
toStr(), and allocated the buffer using char count instead of byte
count. fromByteArray() threw an exception for strings instead of
deserializing them. Fix both directions using a length-prefixed
format, and also fix the misleading "Unknown Tensor dtype" error
message. Add round-trip tests for ASCII, empty, and Unicode strings.
Test plan
CI