What is TensorFlow (TF)?

"
TensorFlow is a programming system in which you represent computations as graphs. Nodes in the graph are called ops (short for operations). An op takes zero or more Tensors, performs some computation, and produces zero or more Tensors. A Tensor is a typed multi-dimensional array. For example, you can represent a mini-batch of images as a 4-D array of floating point numbers with dimensions [batch, height, width, channels].

A TensorFlow graph is a description of computations. To compute anything, a graph must be launched in a Session. A Session places the graph ops onto Devices, such as CPUs or GPUs, and provides methods to execute them. These methods return tensors produced by ops as numpy ndarray objects in Python, and as tensorflow::Tensor instances in C and C++.
The computation graph

TensorFlow programs are usually structured into a construction phase, that assembles a graph, and an execution phase that uses a session to execute ops in the graph.

For example, it is common to create a graph to represent and train a neural network in the construction phase, and then repeatedly execute a set of training ops in the graph in the execution phase.

TensorFlow can be used from C, C++, and Python programs. It is presently much easier to use the Python library to assemble graphs, as it provides a large set of helper functions not available in the C and C++ libraries.

The session libraries have equivalent functionalities for the three languages.
"

Installing TensorFlow

Since I wanted to use TF with Windows 10, but TF is only supported for Linux + Mac OS X,
I set up a VMWare which runs Ubuntu.

Then I followed these instructions, which uses pip to install TF (there are several approaches to install
TF)

A first TensorFlow program

Note: In TF tensors are n-dimensional arrays. We can create a constant tensor (that does not change over time) with tf.constant():

Here is a first simple TensorFlow script:

# A first simple TensorFlow program
#
# Constructs a very simple graph that
# does just a little bit linear algebra
#
# by Prof. Dr. Juergen Brauer, www.juergenbrauer.org
# import the TensorFlow module
import tensorflow as tf
# also import numpy for defining n-dimensional arrays directly
import numpy as np
# create two tensors (n-dimensional arrays)
M1 = np.array([(1,2,3),(4,5,6),(7,8,9)])
print("\nM1=",M1)
tensor1 = tf.constant(M1)
M2 = np.array([(10,20,30),(40,50,60),(70,80,90)])
print("\nM2=",M2)
tensor2 = tf.constant(M2)
# create a graph op for adding the two matrices
op1 = tf.add(tensor1,tensor2)
# now get a session object:
# A session is a specific distribution of the graph operations to
# be performed on your computing resources: it depends on how many
# CPUs and GPUs you have
sess = tf.Session()
# now let the graph work and compute the result
result = sess.run(op1)
# output the result of the computation
print("\nresult=",result)
print("\nData types of the objects used here:")
print("tensor1 has data type", type(tensor1))
print("tensor2 has data type", type(tensor2))
print("op1 has data type", type(op1))
print("sess has data type", type(sess))
print("result has data type", type(result))
print("\n")