-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[java] Make the backing byte buffer in an OrtValue accessible (#16578)
### Description Adds a method to access the backing direct byte buffer from a Java `OnnxTensor` object, assuming it is backed by a direct byte buffer (tensors created by ORT's run call or ones created in Java from multidimensional arrays are not). Also adds a method to check if the backing byte buffer was copied from the user's buffer supplied on creation (this could be tested via a pointer comparison from the output of `getBufferRef` and the user's input buffer, so I'm not sure if it's necessary). ### Motivation and Context This is the first part of changes necessary to support output pinning in Java OrtSession.run/OrtTrainingSession.run calls. I split it out from the rest of the work as it's useful by itself (e.g. to allow users to keep a single input tensor and rewrite it each time with new inputs rather than allocate a fresh one) and the other change will be much more involved so splitting it makes it easier to review. cc @yuslepukhin
- Loading branch information
Showing
2 changed files
with
141 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters