Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a closeable session result #411
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
Adds a closeable session result #411
Changes from 8 commits
155fdd6
1450980
1035b1d
5e92bc1
5f89ee1
b122dd0
ad9172c
022d103
48ea545
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 think it can still be useful in some cases for a user to retain the lifetime of a specific tensor beyond the scope of the
Result
, and it shouldn't be hard to do using reference counts internally.What about adding a
getAndRetain(...)
endpoint to do this? If not being added as part of this PR, I can play around it after.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.
Rather than do reference counting it could have a
BitSet
denoting if the tensor should be closed? It would be a one way operation, you couldgetAndRetain
and then the lifetime of the tensor is up to you with no way of putting it back under theResult
management.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 already use reference counting for managing sparse tensors, I think if we can stick internally to a single method for extending the life of a tensor, it would be better.
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.
After some investigation we couldn't use the
retainReference
idiom to extend the lifespan of theTensor
as then theRawTensor
'sPointerScope
loses track of it. So we're going to leave thegetAndRetain
method as a todo for when we have a look at managingTensor
lifespans better.