Go to previous topic
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
Author Messages
Patrick Ng
Basic Member
Basic Member
Posts:148


--
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 -

    https://stackoverflow.com...ttribute-placeholder

    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 -
    https://stackoverflow.com...er-in-tensorflow-2-0

    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!




    0


    ---