<jupyter_start><jupyter_text>Ch `02`: Concept `03`  Interactive session Interactive sessions are another way to use a session. Go ahead and define one:InterativeSession() 创建的session可以用于单步调试<jupyter_code>import tensorflow as tf
sess = tf.InteractiveSession()<jupyter_output><empty_output><jupyter_text>We have a matrix we want to invert:<jupyter_code>x = tf.constant([[1., 2.]])
neg_op = tf.negative(x)<jupyter_output><empty_output><jupyter_text>Since we're using an interactive session, we can just call the `eval()` method on the op.`eval()`用于输入tensor节点<jupyter_code>result = neg_op.eval()

print(result)<jupyter_output>[[-1. -2.]]<jupyter_text>That code's a little cleaner when using Jupyter notebooks (like this one).Don't forget to close the session:<jupyter_code>sess.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11728395061728394, 'fraction_numerical': 0.009876543209876543, 'mean_word_length': 7.912087912087912, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '255280', 'license': 'MIT', 'n_tokens_mistral': 304, 'n_tokens_neox': 293, 'n_words': 71, 'path': 'ch02_basics/03_interactive_session.ipynb', 'repo_name': 'pythonProjectLearn/TensorflowLearning', 'size': '810'}