openai / generating-reviews-discovering-sentiment

Code for "Learning to Generate Reviews and Discovering Sentiment"
https://arxiv.org/abs/1704.01444
MIT License
1.51k stars 380 forks source link

Code compatibility with Tensorflow 1.7 #52

Open gitathrun opened 6 years ago

gitathrun commented 6 years ago

Recently update my Tensorflow to 1.7, when loading the model, got an warning:

model = Model()
WARNING:tensorflow: From xxxxxxx\encoder.py: 59: calling l2_normalize (from tensorflow.python.ops.nn_impl) with dim is deprecated and will be removed in a future version.

Changed the code from encoder.py: 58-62 change the dim parameter into axis

    if wn:
        wx = tf.nn.l2_normalize(wx, axis=0) * gx
        wh = tf.nn.l2_normalize(wh, axis=0) * gh
        wmx = tf.nn.l2_normalize(wmx, axis=0) * gmx
        wmh = tf.nn.l2_normalize(wmh, axis=0) * gmh

The warning is gone.

gitathrun commented 6 years ago

I think I posted in the wrong category, please delete this post, and the same topic issue is posted in "Issues" category. Thank you.