Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在Jupyter中运行tf.InteractiveSession()时出现问题_Python_Tensorflow_Jupyter_Interactive - Fatal编程技术网

Python 在Jupyter中运行tf.InteractiveSession()时出现问题

Python 在Jupyter中运行tf.InteractiveSession()时出现问题,python,tensorflow,jupyter,interactive,Python,Tensorflow,Jupyter,Interactive,我在Jupyter中运行tf.InteractiveSession()时遇到问题,我不知道如何修改它。我是一个初学者,所以我希望得到一些指导 在此处输入此代码: import tensorflow as tf sess = tf.InteractiveSession() x = tf.constant([[1, 2]]) negMatrix = tf.negative(x) result = negMatrix.eval() print(result) sess.close() 生成以下

我在Jupyter中运行
tf.InteractiveSession()
时遇到问题,我不知道如何修改它。我是一个初学者,所以我希望得到一些指导

在此处输入此代码:

import tensorflow as tf
sess = tf.InteractiveSession()

x = tf.constant([[1, 2]])
negMatrix = tf.negative(x)

result = negMatrix.eval()
print(result)

sess.close()
生成以下错误消息:

**AttributeError**: module 'tensorflow' has no attribute 'InteractiveSession'

您使用的是什么版本的tensorflow和jupyter?回答了您的问题吗?如果使用tensorflow v 1.13.2解决了,请告诉我这是否回答了您的问题?