-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
welcome.py
27 lines (19 loc) · 880 Bytes
/
welcome.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
"""welcome.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/github/instillai/TensorFlow-Course/blob/master/codes/ipython/0-welcome/welcome.ipynb
"""
# Import tensorflow
import tensorflow as tf
# Check version
print("Tensorflow version: ", tf.__version__)
# Test TensorFlow for cuda availibility
print("Tensorflow is built with CUDA: ", tf.test.is_built_with_cuda())
# Check devices
print("All devices: ", tf.config.list_physical_devices(device_type=None))
print("GPU devices: ", tf.config.list_physical_devices(device_type='GPU'))
# Print a randomly generated tensor
# tf.math.reduce_sum: https://www.tensorflow.org/api_docs/python/tf/math/reduce_sum
# tf.random.normal: https://www.tensorflow.org/api_docs/python/tf/random/normal
print(tf.math.reduce_sum(tf.random.normal([1, 10])))