Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Neural Network Programming with TensorFlow

You're reading from   Neural Network Programming with TensorFlow Unleash the power of TensorFlow to train efficient neural networks

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781788390392
Length 274 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Manpreet Singh Ghotra Manpreet Singh Ghotra
Author Profile Icon Manpreet Singh Ghotra
Manpreet Singh Ghotra
Rajdeep Dua Rajdeep Dua
Author Profile Icon Rajdeep Dua
Rajdeep Dua
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Maths for Neural Networks FREE CHAPTER 2. Deep Feedforward Networks 3. Optimization for Neural Networks 4. Convolutional Neural Networks 5. Recurrent Neural Networks 6. Generative Models 7. Deep Belief Networking 8. Autoencoders 9. Research in Neural Networks 10. Getting started with TensorFlow

Auto differentiation


Auto differentiation is also known as algorithmic differentiation, which is an automatic way of numerically computing the derivatives of a function. It is helpful for computing gradients, Jacobians, and Hessians for use in applications such as numerical optimization. Backpropagation algorithm is an implementation of the reverse mode of automatic differentiation for calculating the gradient.

In the following example, using the mnist dataset, we calculate the loss using one of the loss functions. The question is: how do we fit the model to the data?

We can use tf.train.Optimizer and create an optimizer. tf.train.Optimizer.minimize(loss, var_list) adds an optimization operation to the computational graph and automatic differentiation computes gradients without user input:

import TensorFlow  as tf

# get mnist dataset
from TensorFlow .examples.tutorials.mnist import input_data
data = input_data.read_data_sets("MNIST_data/", one_hot=True)

# x represents image with 784 values...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image