Guest User

Untitled

a guest
Apr 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. def build(self, graph=None, optimizer=None):
  2. """
  3. Creates model graph and groups important variables into named collections.
  4. """
  5. if graph is None:
  6. graph = tf.Graph()
  7. with graph.as_default():
  8. inputs = create_inputs()
  9. logits = build_model(
  10. inputs=inputs.x,
  11. layers=self.hidden_layers,
  12. n_outputs=self.n_classes,
  13. activation=self.activation)
  14. training_op, metrics = create_optimizer(
  15. labels=inputs.y,
  16. logits=logits,
  17. opt_cls=optimizer)
  18. add_to_collection('inputs', *inputs)
  19. add_to_collection('metrics', *metrics)
  20. add_to_collection('training', logits, training_op)
  21. self._graph = graph
Add Comment
Please, Sign In to add comment