import math
from matplotlib import pyplot as plt

a=1
b=2

a+b

"""
Explanation: Welcome to Jupyter!
With Jupyter notebooks you can write and execute code, annotate it with Markdownd and use powerful visualization tools all in one document.
Running code
Code cells can be executed in sequence by pressing Shift-ENTER. Try it now.
End of explanation
"""


def display_sinusoid():
  X = range(180)
  Y = [math.sin(x/10.0) for x in X]
  plt.plot(X, Y)

display_sinusoid()

"""
Explanation: Visualisations
Many Python visualization libratries, matplotlib for exampl, intergate seamlessly with Jupyter. Visualiazations will appear directly in the notebook.
End of explanation
"""


import tensorflow as tf
from tensorflow.python.client import device_lib
print("Tensorflow version " + tf.__version__)

try:
    tpu = tf.contrib.cluster_resolver.TPUClusterResolver() # TPU detection
    strategy = tf.contrib.tpu.TPUDistributionStrategy(tpu)
    print("Running on TPU")
except ValueError:
    local_devices = device_lib.list_local_devices()
    gpu_list = [x.name for x in local_devices if x.device_type == 'GPU']
    if gpu_list:
        print("Running on GPU: {}".format(gpu_list))
    else:
        print("Running on CPU")

"""
Explanation: Tensorflow environment and accelerators
On Google's AI Platform notebooks, Tensorflow support is built-in and powerful accelerators are supported out of the box. Run this cell to test if your current notebook instance has Tensorflow and an accelerator (in some codelabs, you will add an accelerator later).
End of explanation
"""


