Skip to content
Vivek edited this page Feb 19, 2017 · 1 revision

Welcome to the HiTensorflow wiki!

Important Terms (from google documentation)

Tensors

The central unit of data in Tensorflow is the tensor. A tensor consists of a set of primitive values shaped into an array of any number of dimensions. A tensor's rank is its number of dimensions. Examples of tensors:

3 : This is a rank 0 tensor; this is a scalar with shape []
[1.,2.,3.] : This is a rank 1 tensor; this is a vector with shape [3]

The Computational Graph

We can think of Tensorflow programs as consisting of two parts :

  1. Building the Computational Graph
  2. Running the Computational Graph

A Computational Graph is a series of Tensorflow operations arranged into a graph of nodes

Session

We can create tensorflow nodes eg: constants, or operations(adding two constants), etc. But printing these will only print the Tensor and not the actual value of constant or the operation. To do so we actually need to evaluate the node. And this part is done within a session

sess = tf.Session()
sess.run(node1)

Placeholders

A graph with constant results would not be interesting. A graph can be parameterized to accept external inputs, known as placeholders. A placeholder is a promise to provide a value later a = tf.placeholder(tf.float32)

TensorBoard

A utility which can visualize our nodes/operations and represent them as a graph. This is provided by tensorflow

Variables

In machine learning we typically want a model that can take arbitrary inputs. To make a model trainable we need to be able to modify the graph with same input. Variables allows us to add trainable parameters to a graph. They are constructed with a type and initial value.

`W = tf.Variable([.3],tf.float32)

Note Constants are initialized when we call tf.constant, and their value can never be changed. By contrast variables are not initialized on call of tf.Variable. To initialize all variables in a Tensorflow program we must explicitly call a special operation as follows:

init = tf.global_variables_initializer()
sess.run(init)

tf.train API

Tensorflow provides optimizers that slowly change each variable in order to minimize the loss function. The simplest optimizer is gradient descent. optimizer = tf.train.GradientDescentOptimizer(0.01)

tf.contrib.learn

tf.contrib.learn is a high-level Tensorflow library that simplifies the mechanics of machine learning, including the following :

  • running training loops
  • running evaluation loops
  • managing data sets
  • managing feeding

tf.contrib.learn defines many common models.