Skip to content

jakeval/tensorflow_tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

A brief introduction to tensorflow

Step 1: background on tensorflow

  • Tensor: an array or matrix of values
  • Method of defining tensors and operations on tensors
  • Each operation of two tensors returns another tensor
  • Tensorflow defines many useful operations out of the box (such as softmax), making it easy to create neural nets
  • Tensorflow lets you define tensors and operations in python, and then runs them very efficiently in C, only returning to python after all computation is finished

Step 2: installation

  • Windows: install natively with pip or use conda
  • Linux and Mac: install with pip or with virtualenv
  • If using conda, follow conda installation wizard
  • With pip, simply run pip3 install --upgrade tensorflow

Step 3: playing with tf

  • open up an interactive console and start python
  • let's simply compute the dot product of two tensors X, Y using tf
  • to create a tensor X, use tf.placeholder()
  • "X*Y" is a shorthand for matrix multiplication; this will multiply our tensors
  • to actually begin computation, define an interactive session and use it to evaluate our tensors

Code:

>>>X = tf.placeholder(tf.float32,[3], name='X')

>>>Y = tf.placeholder(tf.float32,[3], name='Y')

>>>mult = X * tf.transpose(Y)

>>>sess = tf.InteractiveSession()

>>>sess.run(mult, feed_dict={X:[1,2,3], Y:[1,2,3]})

Step 4: your first neural network

Follow the instructions at https://www.tensorflow.org/versions/r1.1/get_started/mnist/beginners

These instructions are for an outdated version of tensorflow, but still work. I choose this tutorial because it is very simple, and exposes the math behind the neural network. More recent tutorials focus on data manipulation/feature extraction and use of the high level estimators API.

Those wishing more experience with ML and tensorflow should follow the more recent tutorial, available here: https://www.tensorflow.org/get_started/get_started_for_beginners

About

A brief introduction to tensorflow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages