Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
108 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Layering Nested Operations | ||
|
||
import os | ||
import numpy as np | ||
import tensorflow as tf | ||
from tensorflow.python.framework import ops | ||
ops.reset_default_graph() | ||
|
||
# Start a graph session | ||
sess = tf.Session() | ||
|
||
# Create the data and variables | ||
my_array = np.array([[1., 3., 5., 7., 9.], | ||
[-2., 0., 2., 4., 6.], | ||
[-6., -3., 0., 3., 6.]]) | ||
x_vals = np.array([my_array, my_array + 1]) | ||
x_data = tf.placeholder(tf.float32, shape=(3, 5)) | ||
|
||
# Constants for matrix multiplication: | ||
m1 = tf.constant([[1.], [0.], [-1.], [2.], [4.]]) | ||
m2 = tf.constant([[2.]]) | ||
a1 = tf.constant([[10.]]) | ||
|
||
# Create our multiple operations | ||
prod1 = tf.matmul(x_data, m1) | ||
prod2 = tf.matmul(prod1, m2) | ||
add1 = tf.add(prod2, a1) | ||
|
||
# Now feed data through placeholder and print results | ||
for x_val in x_vals: | ||
print(sess.run(add1, feed_dict={x_data: x_val})) | ||
|
||
# View the tensorboard graph by running the following code and then | ||
# going to the terminal and typing: | ||
# $ tensorboard --logdir=tensorboard_logs | ||
merged = tf.summary.merge_all() | ||
if not os.path.exists('tensorboard_logs/'): | ||
os.makedirs('tensorboard_logs/') | ||
|
||
my_writer = tf.summary.FileWriter('tensorboard_logs/', sess.graph) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
tensorflow | ||
numpy | ||
scipy | ||
sklearn | ||
requests | ||
jupyter | ||
matplotlib | ||
tensorflow==1.6.0 | ||
numpy==1.14.2 | ||
scipy==1.0.0 | ||
sklearn==0.19.1 | ||
jupyter==1.0.0 | ||
matplotlib==2.2.2 | ||
requests==2.18.4 | ||
Pillow==5.0.0 |