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

flatten() function #1462

Closed
wants to merge 6 commits into from
Closed

Conversation

Ishticode
Copy link
Contributor

@djl11
Couldn't find flatten(). If it is implemented with a different name then i will close this.
If you think this is good addition then i will write up some docstring and typehints and fix the test.
Just felt it was needed at times...

@Ishticode Ishticode requested a review from djl11 June 16, 2022 12:25
shape = 1
for dim in x.shape:
shape *= dim
return tf.reshape(x, shape)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does TensorFlow not support tf.reshape(x, -1)?

Copy link
Contributor

Choose a reason for hiding this comment

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

If it does not, you can do this in one line like so:

import math
tf.reshape(x, math.prod(x.shape))

Copy link
Contributor Author

@Ishticode Ishticode Jun 17, 2022

Choose a reason for hiding this comment

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

In fact. tf.reshape will do the job

Copy link
Contributor

@djl11 djl11 left a comment

Choose a reason for hiding this comment

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

Please respond to the comments, and then re-request a review.

@Ishticode Ishticode closed this Jul 9, 2022
@iamjameskeane iamjameskeane linked an issue Aug 24, 2022 that may be closed by this pull request
@Ishticode
Copy link
Contributor Author

Will reopen and merge.

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.

ivy.flatten
3 participants