0% found this document useful (0 votes)
113 views12 pages

10 TensorFlow PDF

Uploaded by

rana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views12 pages

10 TensorFlow PDF

Uploaded by

rana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

TensorFlow

Prof. Gheith Abandah

Reference: Hands-On Machine Learning with Scikit-Learn and


TensorFlow by Aurélien Géron (O’Reilly). Copyright 2017 Aurélien
Géron, 978-1-491-96229-9.

1
Introduction
• YouTube Video: Deep Learning with TensorFlow -
Introduction to TensorFlow from Cognitive Class

https://youtu.be/MotG3XI2qSs

2
Outline

1. Introduction
2. Installation
3. Example
4. Lifecycle of a node value
5. Exercises

3
1. Introduction
• TensorFlow is a powerful
open source, well
supported, software library
for numerical computation,
particularly for large-scale
Machine Learning.
• Its basic principle is simple:
• you first define in Python a
graph of computations to
perform,
• and then TensorFlow takes
that graph and runs it
efficiently using optimized
C++ code.

4
1. Introduction
• It is possible to break up
the graph into several
chunks and run them in
parallel across multiple
CPUs or GPUs.
• TensorFlow also supports
distributed computing, so
you can train colossal
neural networks on
humongous training sets in
a reasonable amount of
time by splitting the
computations across
hundreds of servers.

5
1. Introduction
• Runs on Windows, Linux, and macOS, iOS, and Android.
• It provides a very simple Python APIs:
• Keras (the only and the official high-level API in Version 2.0)
• TF.Learn (tensorflow.contrib.learn), compatible with Scikit-
Learn
• TF-slim (tensorflow.contrib.slim)
• Pretty Tensor
• Its main Python API offers much more flexibility (at the
cost of higher complexity) to create all sorts of
computations, including various neural network
architectures.
• Includes a visualization tool called TensorBoard
6
2. Installation
• On a cmd window, execute:
pip3 install --upgrade tensorflow
• To verify, enter and run the following in Python:
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
• If the system outputs the following, then you are ready
to begin writing TensorFlow programs:
Hello, TensorFlow!

7
3. Example
• The following code creates the graph represented
in Slide 4.

• Create session, initialize vars, evaluate, and close.

8
3. Example
• A better way in a Python program.

• Alternatively, you can create and run an


initialization node for all variables.

9
4. Lifecycle of a Node Value
• When you evaluate a node, TensorFlow
automatically determines the set of nodes that it
depends on and it evaluates these nodes first.

Note: To evaluate y and z efficiently,


without evaluating w and x twice,
code, use:

10
Summary

1. Introduction
2. Installation
3. Example
4. Lifecycle of a node value
5. Exercises

11
Exercises
• Check TensorFlow exercises on:
https://github.com/Kyubyong/tensorflow-exercises

12

You might also like