I just installed new tf and cuda today, but when I run the previous code that worked with tf-1.4 won't work under new tensorflow-2.1.0 and cuda-10.1
How to fix this?
Mentioning the Solution in the Answer Section (even though it is present in Comments Section), for the benefit of the Community.
Replacing the command,
import tensorflow as tf
with
import tensorflow.compat.v1 as tf
has resolved the error.
For more information about Migrating from Tensorflow 1.x to 2.x, please refer this Tensorflow Tutorial and this Upgrade Script also will be helpful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.