Skip to content

How to fill a PyTorch string_view input #1390

Answered by HGuillemet
sbrunk asked this question in Q&A

You must be logged in to vote

Ok. I have came up with a solution with an adapter working. New PR coming.
Like in StringAdapter, I tested the size passed to the (ptr, size, owner) constructors and did a strlen if it's 0.
But I wonder if it won't be better to have the generator produce a JNI call to getStringUTFLength, along with getStringUTFChars, and pass this length to the adapter.

Replies: 2 comments 3 replies

You must be logged in to vote
0 replies

You must be logged in to vote
3 replies
@saudet

@HGuillemet

Answer selected by sbrunk
@sbrunk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants