<jupyter_start><jupyter_text>--- TensorFlow v2<jupyter_code>x = tf.constant([[1., 2.]])
negMatrix = tf.negative(x)
result = negMatrix.numpy()
print(result)<jupyter_output>[[-1. -2.]]<jupyter_text>--- TensorFlow v1 Compatibility<jupyter_code>import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
sess = tf.InteractiveSession()
x = tf.constant([[1., 2.]])
negMatrix = tf.negative(x)
result = negMatrix.eval()
print(result)
sess.close()<jupyter_output>[[-1. -2.]]<jupyter_text>--- _Warning_Attempting to combine v1 and v2 features without disabling eager execution can prove fatal:<jupyter_code>import tensorflow as tf
sess = tf.compat.v1.InteractiveSession()
x = tf.constant([[1., 2.]])
negMatrix = tf.negative(x)
result = negMatrix.eval()
print(result)
sess.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16520650813516896, 'fraction_numerical': 0.02127659574468085, 'mean_word_length': 6.2727272727272725, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '55321', 'license': 'Apache-2.0', 'n_tokens_mistral': 311, 'n_tokens_neox': 303, 'n_words': 58, 'path': 'TFv2/ch02/Listing 2.07.ipynb', 'repo_name': 'fneitzel/MLwithTensorFlow2ed', 'size': '799'}