Introduction to the Python Deep Learning Library TensorFlow

TensorFlow is an open source library for fast numerical computing.

It was created and is maintained by Google and released under the Apache 2.0 open source license. The API is nominally for the Python programming language, although there is access to the underlying C++ API.

Unlike other numerical libraries intended for use in Deep Learning like Theano, TensorFlow was designed for use both in research and development and in production systems, not least RankBrain in Google search and the fun DeepDream project.

It can run on single CPU systems, GPUs as well as mobile devices and large scale distributed systems of hundreds of machines.

  • How to Install TensorFlow

    Installation of TensorFlow is straightforward if you already have a Python SciPy environment.

    TensorFlow works with Python 3.3+. You can follow the Download and Setup instructions on the TensorFlow website. Installation is probably simplest via PyPI and specific instructions of the pip command to use for your Linux or Mac OS X platform are on the Download and Setup webpage. In the simplest case, you just need to enter the following in your command line:

    Exception would be on the newer Mac with Apple Silicon CPU. The package name for this specific architecture is tensorflow-macos instead:

  • Computation with TensorFlow

    This first example is a modified version of the example on the TensorFlow website. It shows how you can define values as tensors and execute a operation.

  • Linear Regression with TensorFlow

    This next example comes from the introduction on the TensorFlow tutorial.

    This examples shows how you can define variables (e.g. W and b) as well as variables that are the result of computation (y).

    We get some sense of TensorFlow separates the definition and declaration of the computation. In below, there is automatic differentiation under the hood. When we use the function mse_loss() to compute the difference between y and y_data, there is a graph created connecting the value produced by the function to the TensorFlow variables W and b. TensorFlow uses this graph to deduce how to update the variables inside the minimize() function.

  • More Deep Learning Models

    Your TensorFlow installation comes with a number of Deep Learning models that you can use and experiment with directly.


Leave a Reply

Call Us