-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
flatten() function #1462
Conversation
…into flatten()-function
shape = 1 | ||
for dim in x.shape: | ||
shape *= dim | ||
return tf.reshape(x, shape) |
There was a problem hiding this comment.
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)
?
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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
There was a problem hiding this 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.
Will reopen and merge. |
@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...