使用
tf.get_default_session().run(self.train_op,..., )
时候返回:‘NoneType‘ object has no attribute ‘run‘的错误,这是因为使用了
sess = tf.Session(config=config)
应该使用:
sess = tf.InteractiveSession(config=config)
因为:Unlike tf.InteractiveSession
, a tf.Session
becomes a default only inside with
block (it's a context manager):
参考文献为: