Skip to content
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

Go: Deallocate large TF_TString on Tensor finalization #46541

Merged
merged 1 commit into from Mar 3, 2021

Conversation

furdarius
Copy link
Contributor

Since version 2.4 Tensorflow moved to the new way to store string tensors.

Earlier std::string was used an array of strings was encoded as an array of 8-byte offsets followed by string data. With the current design of the tensorflow::tstring creating tensor with NewTensor function could allocate string in two ways (description of the tstring types):

  • TF_TSTR_SMALL - the contents of strings less than 22-bytes are stored in the TF_TString struct
  • TF_TSTR_LARGE - Heap allocated string

The second case assumes that, in addition to TF_DeleteTensor, the string should be deallocated with TF_TString_Dealloc. This situation wasn't handled in the Go bindings.

@google-ml-butler google-ml-butler bot added the size:S CL Change Size: Small label Jan 19, 2021
@google-cla google-cla bot added the cla: yes label Jan 19, 2021
@gbaned gbaned self-assigned this Jan 20, 2021
@gbaned gbaned added this to Assigned Reviewer in PR Queue via automation Jan 20, 2021
@gbaned gbaned requested a review from jhseu January 20, 2021 02:53
@gbaned gbaned added the awaiting review Pull request awaiting review label Jan 28, 2021
@gbaned gbaned requested a review from frankchn March 1, 2021 17:37
PR Queue automation moved this from Assigned Reviewer to Approved by Reviewer Mar 2, 2021
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Mar 2, 2021
@rthadur rthadur removed awaiting review Pull request awaiting review kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Mar 3, 2021
@google-ml-butler google-ml-butler bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Mar 3, 2021
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 3, 2021
@copybara-service copybara-service bot merged commit d96bce7 into tensorflow:master Mar 3, 2021
PR Queue automation moved this from Approved by Reviewer to Merged Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes ready to pull PR ready for merge process size:S CL Change Size: Small
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

5 participants