Skip to content

Update addition example's python code for tf2.5 #307

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

Merged
merged 2 commits into from
Jul 15, 2021
Merged

Update addition example's python code for tf2.5 #307

merged 2 commits into from
Jul 15, 2021

Conversation

dskkato
Copy link
Contributor

@dskkato dskkato commented Jul 10, 2021

I tried to migrate Python code using TensorFlow 2.x version.

In TensorFlow 2.x, the eager mode is ON by default, which makes it hard to get a concrete computation graph. One way to obtain a similar result is to wrap the function and use get_concrete_function method like in this PR.

Please refer to TF documents for detail : https://www.tensorflow.org/guide/function

I also tried to change outputs node name (which is Identity now), for compatibility, but could not find any solution regarding to this point. Please note that this PR makes the addition example totally incompatible with TensorFlow 1.x versions.

I'm glad to take any feedback. And if you already working on this point in a different way, please let it go.

@google-cla
Copy link

google-cla bot commented Jul 10, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@dskkato
Copy link
Contributor Author

dskkato commented Jul 10, 2021

@googlebot I signed it!

@dskkato dskkato changed the title [WIP] update addition example's python code for tf2.5 Update addition example's python code for tf2.5 Jul 12, 2021
@adamcrume
Copy link
Contributor

Thanks for the update! This looks good to me. I think it's fine if the examples require TensorFlow 2, since that's what the library is now targeting.

@adamcrume adamcrume merged commit b78afaf into tensorflow:master Jul 15, 2021
@dskkato dskkato deleted the examples/addition branch July 16, 2021 14:09
@ptitfred
Copy link

ptitfred commented Jul 2, 2024

Please note that when ran as advertised (in the examples/addition directory) it creates another subtree examples/addition/examples/addition.

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.

3 participants