Skip to content

Conversation

@tafsiri
Copy link
Contributor

@tafsiri tafsiri commented Sep 10, 2020

This adds a workaround for how babel compiles our classes, and should fix #3384.

The main issue is that babel will try and run instanceof on a tensor before our constructor body has executed. This works around this by checking for the presence of methods on Tensor.

To see the logs from the Cloud Build CI, please join either our discussion or announcement mailing list.


This change is Reviewable

Copy link
Contributor

@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 @tafsiri)


tfjs-core/src/tensor.ts, line 446 at r1 (raw file):

Object.defineProperty(Tensor, Symbol.hasInstance, {
  value: (instance: Tensor) => {
    // Implementation note: we should use properties of the object will be

of the object that will be defined

Copy link
Contributor Author

@tafsiri tafsiri 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, @dsmilkov, and @nsthorat)


tfjs-core/src/tensor.ts, line 446 at r1 (raw file):

Previously, annxingyuan (Ann Yuan) wrote…

of the object that will be defined

done

@tafsiri tafsiri merged commit e39ba95 into master Sep 11, 2020
@tafsiri tafsiri deleted the symbol-hasInstance-babel-compatibility-2 branch September 11, 2020 17:58
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.

React production build will not compile TensorFlow.js 2.0

3 participants