#原 config = tf.ConfigProto(allow_soft_placement=True)
config = tf.compat.v1.ConfigProto(allow_soft_placement=True)
#原 sess = tf.Session(config=config)
sess =tf.compat.v1.Session(config=config)

或使用

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

替换

import tensorflow as tf
#原 config = tf.ConfigProto(allow_soft_placement=True)
config = tf.compat.v1.ConfigProto(allow_soft_placement=True)
#原 sess = tf.Session(config=config)
sess =tf.compat.v1.Session(config=config)

或使用

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

替换

import tensorflow as tf

相关文章:

  • 2021-09-18
  • 2022-12-23
  • 2021-08-10
  • 2021-11-16
  • 2022-12-23
  • 2022-01-13
  • 2021-11-18
  • 2021-10-19
猜你喜欢
  • 2020-02-27
  • 2021-06-07
  • 2021-12-24
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案