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

Fix flatten implementation on objects #7059

Merged
merged 4 commits into from
Nov 29, 2022
Merged

Fix flatten implementation on objects #7059

merged 4 commits into from
Nov 29, 2022

Conversation

ahmedsabie
Copy link
Contributor

@ahmedsabie ahmedsabie commented Nov 18, 2022

Fixes #6989.

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


This change is Reviewable

Copy link
Collaborator

@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.

In the issue, the skipTypedArray flag seems to have been set to true?
flatten(x, [], true), will your fix cover that use case?

Reviewable status: 0 of 1 approvals obtained (waiting on @ahmedsabie and @jinjingforever)


tfjs-core/src/util_test.ts line 183 at r1 (raw file):

  });

  it('index signature', () => {

what is the use case for supporting number indexed map?

Copy link
Contributor Author

@ahmedsabie ahmedsabie left a comment

Choose a reason for hiding this comment

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

It doesn't matter Int8Array is not part of our TypedArray definition

Reviewable status: 0 of 1 approvals obtained (waiting on @jinjingforever and @pyu10055)


tfjs-core/src/util_test.ts line 183 at r1 (raw file):

Previously, pyu10055 (Ping Yu) wrote…

what is the use case for supporting number indexed map?

Int8Array and any other fixed size buffers/arrays all fit the index signature interface but do not pass Array.isArray.

Also it doesn't make sense to have RecursiveArray be defined as an index signature and then write a function flatten that's broken on non-array index signatures. That breaks the function type unless an error was meant to be thrown, but then RecursiveArray should not be defined as index signature.

Copy link
Collaborator

@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.

#6989
thanks for the explanation

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

@pyu10055 pyu10055 merged commit fcc2f92 into master Nov 29, 2022
@pyu10055 pyu10055 deleted the fix-6989 branch November 29, 2022 21:14
Linchenn pushed a commit to Linchenn/tfjs that referenced this pull request Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tf.conv2d incorrectly handles inputs of type Int8Array.
3 participants