Skip to content

Conversation

@pyu10055
Copy link
Collaborator

@pyu10055 pyu10055 commented Aug 6, 2020

fix issue #3739
#3741
To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

@pyu10055 pyu10055 requested a review from lina128 August 6, 2020 17:53
Copy link
Collaborator

@lina128 lina128 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: 0 of 1 approvals obtained (waiting on @lina128 and @pyu10055)


tfjs-converter/src/operations/executors/control_executor.ts, line 110 at r1 (raw file):

    case 'LoopCond': {
      let pred = getParamValue('pred', node, tensorMap, context) as tfc.Tensor;
      if (!pred.kept) {

Can we have some annotation of this logic?


tfjs-converter/src/operations/executors/control_executor.ts, line 111 at r1 (raw file):

      let pred = getParamValue('pred', node, tensorMap, context) as tfc.Tensor;
      if (!pred.kept) {
        pred = pred.clone();

Let's not use chained op, change to pred = clone(pred), this will allow proper tree shaking.


tfjs-converter/src/operations/executors/control_executor.ts, line 111 at r1 (raw file):

      let pred = getParamValue('pred', node, tensorMap, context) as tfc.Tensor;
      if (!pred.kept) {
        pred = pred.clone();

Also, better to make pred immutable and dispose it in the !kept condition because clone will be returned, not the original tensor. Or does it get cleaned up somewhere?

Copy link
Collaborator Author

@pyu10055 pyu10055 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: 0 of 1 approvals obtained (waiting on @lina128)


tfjs-converter/src/operations/executors/control_executor.ts, line 110 at r1 (raw file):

Previously, lina128 (Na Li) wrote…

Can we have some annotation of this logic?

Done.


tfjs-converter/src/operations/executors/control_executor.ts, line 111 at r1 (raw file):

Previously, lina128 (Na Li) wrote…

Let's not use chained op, change to pred = clone(pred), this will allow proper tree shaking.

Done.


tfjs-converter/src/operations/executors/control_executor.ts, line 111 at r1 (raw file):

Previously, lina128 (Na Li) wrote…

Also, better to make pred immutable and dispose it in the !kept condition because clone will be returned, not the original tensor. Or does it get cleaned up somewhere?

this is disposed in the executor.

Copy link
Collaborator

@lina128 lina128 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: 0 of 1 approvals obtained (waiting on @lina128 and @pyu10055)


tfjs-converter/src/operations/executors/control_executor.ts, line 110 at r1 (raw file):

Previously, pyu10055 (Ping Yu) wrote…

Done.

What happens if the tensor is marked as keep, and we still clone? Can we add this reason to the annotation too? Also can we add a test, something that will throw the error in the bug report and can show that after this fix, it solves it?

Copy link
Collaborator

@lina128 lina128 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 @lina128 and @pyu10055)


tfjs-converter/src/operations/executors/control_executor.ts, line 110 at r1 (raw file):

Previously, lina128 (Na Li) wrote…

What happens if the tensor is marked as keep, and we still clone? Can we add this reason to the annotation too? Also can we add a test, something that will throw the error in the bug report and can show that after this fix, it solves it?

Hi Ping, once the annotation is revised to explain possible fail case and how using keep check prevents it. LGTM.


tfjs-converter/src/operations/executors/control_executor.ts, line 111 at r1 (raw file):

Previously, pyu10055 (Ping Yu) wrote…

Done.

Hi Ping, once the

@pyu10055 pyu10055 merged commit 64fb53c into master Aug 6, 2020
@pyu10055 pyu10055 deleted the tensor_clone branch August 6, 2020 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants