-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Add tf.normalize to provide a clean interface for tensor normalization #28741
Comments
Sounds reasonable. I don't think we can deprecate the existing endpoint but I'm happy to add a new one, if someone wants to contribute. |
Hey, I'd like to take a crack at this! Do we add this function as tf.normalize, or tf.math.normalize? |
@astropeak, I am also happy to contribute, maybe we can work together on this? |
@sleighsoft , in that case, maybe you could just do it. I haven't started and could always take other tasks. |
But if the cooperation is a better way, I am happy to work together. How to split the tasks? How we commit codes? |
@astropeak It looks like you already have some other parts of tensorflow in your pipeline. I would like to give it a try and would then like to get your advice once I open a PR. If you already have ideas and suggestions feel free to add them here. |
@sleighsoft @astropeak is someone still working on this? |
I am, just don't have much spare time right now to make fast progress. |
@sleighsoft I see your PR merged. If this issue was resolved by your PR, Please close. Thanks! |
System information
Describe the feature and the current behavior/state.
Currently there are two "ways" to normalize vectors, matrices, and tensors.
tf.math.l2_normalize
tf.norm
The first one directly normalizes the input tensor and returns it.
The latter only computes the norm and the user has to do the division to obtain a normalized tensor.
I propose to add a function called
tf.math.normalize
which has the same/similarargs
astf.norm
. It computes the normalized tensor astf.math.l2_normalize
does but supports all the normalizations thattf.norm
supports.Will this change the current api? How?
No, it just adds a cleaner interface to do normalization.
In the long run
tf.math.l2_normalize
would be obsolete, though. It's implementation could be removed and it could usetf.normalize
internally.Who will benefit with this feature?
When looking for a way to perform l1 normalization I only found
l2_normalize
andtf.norm
. I then expected there to exist al1_normalize
function as well which is not the case.From my point of view this is an inconsistency that people will encounter from time to time.
I would propose to only add this to tensorflow 2.0 and maybe also remove
tf.math.l2_normalize
in that case.The text was updated successfully, but these errors were encountered: