How to do it...

We will proceed with the recipe as follows:

  1. We will start by loading the necessary libraries, including the aforementioned text_helpers.py script, where we will put our functions for text loading and manipulation. We will then start a graph session:
import tensorflow as tf 
import matplotlib.pyplot as plt 
import numpy as np 
import random 
import os 
import pickle 
import string 
import requests 
import collections 
import io 
import tarfile 
import urllib.request 
import text_helpers 
from nltk.corpus import stopwords 
sess = tf.Session() 
  1. We want to make sure that our temporary data and parameter saving folder exists before we start saving to it. Use the following code to check this:
# Make a saving directory if it doesn't exist ...

Get TensorFlow Machine Learning Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.