The model file

The model file should be located in a folder that also contains the __init__.py file.

Let us create a folder named trainer that contains both the model file and the __init__ file:

mkdir trainercd trainer

The preceding code creates the trainer folder and changes directory to the newly-created folder.

Let us go ahead and create the model file as follows:

vim mnist_mlp_lr_numsteps.py

Insert the following code into the previously-created file:

from __future__ import print_functionimport argparseimport pickle from datetime import datetime import numpy as npfrom tensorflow.python.lib.io import file_io # for better file I/Oimport sysimport tensorflow as tfdef train_model(train_file='data/mnist.pkl',job_dir='./tmp/mnist_mlp', num_steps ...

Get Hands-On Machine Learning on Google Cloud Platform 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.