Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Caffe2 Quick Start Guide

You're reading from  Caffe2 Quick Start Guide

Product type Book
Published in May 2019
Publisher Packt
ISBN-13 9781789137750
Pages 136 pages
Edition 1st Edition
Languages
Author (1):
Ashwin Nanjappa Ashwin Nanjappa
Profile icon Ashwin Nanjappa
Toc

Training and monitoring

We begin the training process by creating the network in the workspace and initializing all the parameter blobs of the network in the workspace. This is done by calling the workspace RunNetOnce method:

# The parameter initialization network only needs to be run once.
workspace.RunNetOnce(train_model.param_init_net)

Next, we ask Caffe2 to create the network in memory:

# Creating an actual network as a C++ object in memory.
# We need this as the object is going to be used a lot
# so we avoid creating an object every single time it is used.
workspace.CreateNet(train_model.net, overwrite=True)

We are finally ready to train. We iterate a predetermined number of times and, in each iteration, we use the workspace RunNet method to run a forward pass and a backward pass.

Training a small network such as our LeNet model is fast both on CPU and GPU. However, many of...

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 €14.99/month. Cancel anytime