TensorFlow

Website: https://www.tensorflow.org

TensorFlow is an open source software library for numerical computation using data flow graphs.

TensorFlow is designed and maintained by Google and provides API in Python and C++.

Imperative vs Symbolic style

Imperative style

Below is an example of imperative style programs in Python and NumPy.

import numpy as np
a = np.ones(10)
b = np.ones(10) * 2
c = b * a
d = c + 1

When you run the code, it goes line-by-line. And after running each line of code, it immediately gets the value for variables.

Symbolic style

On the contrary, TensorFlow uses symbolic style programs. An example is given as:

A = Variable('A')
B = Variable('B')
C = B * A
D = C + Constant(1)
# compiles the function
f = compile(D)
d = f(A=np.ones(10), B=np.ones(10)*2)

In this example, all the codes before f = compile(D) only define the operators using nodes. And the program does not do computation using values. When f = compile(D), the code generates the whole computation graph, and then feed in real data through the last line of code. Note: only when running d = f(A=np.ones(10), B=np.ones(10)*2), computation happens.

This example shows the basic idea and the core difference between TensorFlow / Theano / MxNet and traditional programs.

Installation

  • TensorFlow can be easily installed in Linux and Windows.
  • TensorFlow version 1.0 and later has different API from previous version.
  • Please refer to Installing TensorFlow.

Basic Usage

TensorFlow has a relatively steep learning curve.

Here we suggest you follow this learning path, which we believe is suitable for every beginners

Learning Path

  1. Background of Python language.

  2. Read though the whole Getting Started With TensorFlow, and test every line of code by typing into your Python IDE.

  3. Follow the steps and finish MNIST For ML Beginners and Deep MNIST for Experts and TensorFlow Mechanics 101.

  4. You can go through the rest tutorials in Getting Started With TensorFlow and Programmer's Guide.

  5. When you are writing your own code, you will need to frequently refer to Python API.

  6. tf.slim is a light-weight library for TensorFlow. It will let your code cool and elegant. You can refer to its doc TensorFlow-Slim.

Useful Tools

  1. PyCharm: The best IDE for Python languages in all platforms, with quick auto-complete, language check and other powerful tools.
  2. IPython: It provides a powerful command line IDE for python with auto-complete and syntax highlight. It also provides a webpage interface that you can access Python through website browser (locally or remotely).
  3. Sublime Text: A light weight editor for all programming languages. Rich plugins enable advanced features for developing.
  1. Awesome-TensorFlow
  2. Imperative vs Symbolic style
  3. Understanding TensorFlow source codes

results matching ""

    No results matching ""