Skip to content
This repository was archived by the owner on Aug 15, 2019. It is now read-only.

Fix shallow slice bugs: dtype and mem leak#1577

Merged
dsmilkov merged 2 commits intomasterfrom
fix-shallow-master
Feb 19, 2019
Merged

Fix shallow slice bugs: dtype and mem leak#1577
dsmilkov merged 2 commits intomasterfrom
fix-shallow-master

Conversation

@dsmilkov
Copy link
Copy Markdown
Contributor

@dsmilkov dsmilkov commented Feb 19, 2019

When doing shallow slicing:

  • the dtype associated with the tex data can get out of sync with the dtype of the sliced tensor.
  • there is a mem leak related to the intermediate tensor when doing data reads of sliced tensor.

Also fix the chain API for unstack.

Fixes tensorflow/tfjs#1257
Also partially tensorflow/tfjs#569 (fixes Coco-SSD when using tfjs-core 0.15.x once this is cherry-picked)


This change is Reviewable

@dsmilkov dsmilkov requested a review from annxingyuan February 19, 2019 21:06
Copy link
Copy Markdown
Collaborator

@annxingyuan annxingyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @annxingyuan and @dsmilkov)


src/ops/slice_test.ts, line 511 at r1 (raw file):

describeWithFlags('shallow slice an input that was cast', ALL_ENVS, () => {
  beforeAll(() => {
    tf.ENV.set('WEBGL_CPU_FORWARD', false);

Do we need to set this, since jasmine_util.ts specifies WEBGL_CPU_FORWARD to be false for both webgl test environments?

Copy link
Copy Markdown
Contributor Author

@dsmilkov dsmilkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @annxingyuan)


src/ops/slice_test.ts, line 511 at r1 (raw file):

Previously, annxingyuan (Ann Yuan) wrote…

Do we need to set this, since jasmine_util.ts specifies WEBGL_CPU_FORWARD to be false for both webgl test environments?

It's good to set it since it makes the test hermetic (agnostic of what jasmine_util decides). It's also a signal for the reader that to reproduce this problem with casting, you have to not forward to cpu.

@dsmilkov dsmilkov changed the title Fix dtype bug when doing shallow slice Fix dtype bug when doing shallow slice and mem leak Feb 19, 2019
@dsmilkov dsmilkov changed the title Fix dtype bug when doing shallow slice and mem leak Fix shallow slice bugs: dtype and mem leak Feb 19, 2019
@dsmilkov dsmilkov merged commit 83dfbfb into master Feb 19, 2019
@dsmilkov dsmilkov deleted the fix-shallow-master branch February 19, 2019 22:01
dsmilkov added a commit that referenced this pull request Feb 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tensor.data() sometimes leaks a Tensor

2 participants