I am running python program under tensorflow. When I input sess.run(),the command line prompt me that NameError: name 'sess' is not defined
print(sess.run(W_conv1))
Traceback (most recent call last):
File "<ipython-input-17-cf7d3892efbb>", line 1, in <module>
print(sess.run(W_conv1))
NameError: name 'sess' is not defined
You have to define sess. Put this line before accessing it.
sess = tf.Session()
or even you could use a with statement:
with tf.Session() as sess:
#Do something with sess
print(sess.run(W_conv1))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With