This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# View graphs with (Linux): $ tensorboard --logdir=/tmp/my_tf_model | |
import os | |
import tempfile | |
import tensorflow as tf | |
import numpy as np | |
from tensorboard import summary as summary_lib | |
from tensorboard.plugins.custom_scalar import layout_pb2 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Simple example of various types of Tensorflow profiling. | |
Adapted from: | |
https://towardsdatascience.com/howto-profile-tensorflow-1a49fb18073d | |
https://www.tensorflow.org/api_docs/python/tf/profiler/Profiler | |
""" | |
from __future__ import absolute_import | |
from __future__ import division |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tensorflow 1.8.0 | |
import tensorflow as tf | |
import numpy as np | |
def make_iterators(train_dataset, test_dataset): | |
"""Creates the dataset iterators needed in train().""" | |
handle = tf.placeholder(tf.string, shape=[]) | |
tf.add_to_collection('handle', handle) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tensorflow 1.8.0 | |
import tensorflow as tf | |
import numpy as np | |
def save(dataset): | |
""" | |
Create graph with an Dataset and Iterator and save the model. | |
There is some op that is applied to the data from the iterator. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""MWE of a tensorboard setup with | |
- a dummy training and validation op | |
- loss for training and validation shown on the same graph | |
- histograms showing weights changing with training | |
To run tensorboard after running this script | |
$ tensorboard --log_dir=/tmp/tensorboard_demo |
NewerOlder