Skip to content

Exercise solutions for Chapter 11 - Batch Normalization fix #56

Closed
@slabko

Description

In Solution 8.4. (Now try adding Batch Normalization ...) you concluded that with Batch Normalization the model performed even worse. However, I found that there is a little bug in DNNClassifier:

self._graph = tf.Graph()
with self._graph.as_default():
    self._build_graph(n_inputs, n_outputs)

# ... removed 5 lines ... #

# extra ops for batch normalization
extra_update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)

# Now train the model!
self._session = tf.Session(graph=self._graph)
with self._session.as_default() as sess:
    self._init.run()

Here extra_update_ops are taken outside of the graph, I beleive this is the issue with Batch Normalization. If you move the line extra_update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS) into the with self._graph.as_default(): block, it will work pretty close to the original DNNClassifier or even better.

And I reported this bug as an excuse to tell you again how much I love your book. Thank you very much for your incredible work. I'm enjoying every single chapter of it!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions