PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 10 May 2022 08:38 PM by  Patrick Ng
Update codes from Tensorflow 1.0 to 2.0 - Road Taken
 0 Replies
You are not authorized to post a reply.
Author Messages
Patrick Ng
Basic Member
Basic Member

10 May 2022 08:38 PM
    If you are, like me, having bunch of deep neural network (DNN) Tensorflow 1.0 (tf.1) codes that served their purpose, but now want to run on GPU and perform more experiments faster, then the following may help save a weekend (rather than banging head tracking down barrage of error messages).

    Issue - Tensorflow 2 (tf.2) supports GPU but is not backward compatible (tf.1 codes won't run as is).

    Lesson 1 - upgrade from tf.1 to tf.2 (i.e., completed installation), the first roadblock is that placeholders in your codes (how tf.1 handles constants and variables) are no longer recognized in tf.2. Not want to make drastic changes to the codes without planned testing, one option is to suppress tf.2 behavior.

    Workaround link -

    Lesson 2 - deeper you get into DNN code blocks using tf.Estimators and Regressors, sooner or later, come more error messages and headaches. Fire fighting code block one at a time can be tedious and turn into a nightmare.

    Useful link to get over the hump -

    Final decision? Bite the bullet and embrace tf.2 @tf.function wholeheartedly, and take out placeholders from each block accordingly.

    Good luck in your own journey of migrating to tf.2, and share your experience here too!

    You are not authorized to post a reply.


    Andrew Munoz Ensign Natural Resources
    Patrick Ng Shaleforce

    Headquarters Contacts

    Susan Nash Director, Innovation and Emerging Science and Technology breeling