<jupyter_start><jupyter_text>Eager Execution     Eager execution is the default for Tensorflow 2    This first snippet finds out the device in use: a GPU or a CPU    and the device number<jupyter_code>pip install tensorflow==2.0.0-beta1

import tensorflow as tf
var = tf.Variable([20, 20])

if tf.test.is_gpu_available():
    print("I'm running on GPU")
else:
    print("CPU's my thing")
    
# The device number is the last part of the var.device output
# Split it using the `/` separator and get the element at the last index
print(f"Device number: {var.device.split('/')[-1]}")<jupyter_output>Device number:
{'fraction_non_alphanumeric': 0.1, 'fraction_numerical': 0.01639344262295082, 'mean_word_length': 4.267241379310345, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '400703', 'license': 'MIT', 'n_tokens_mistral': 202, 'n_tokens_neox': 191, 'n_words': 75, 'path': 'notebooks/1 intro_to_tensorflow/1.1 eager.ipynb', 'repo_name': 'hogum/tf2', 'size': '610'}