In [2]:
import tensorflow as tf
g = tf.Graph()
with g.as_default():
X = tf.placeholder(tf.float32, name="X")
W1 = tf.placeholder(tf.float32, name="W1")
b1 = tf.placeholder(tf.float32, name="b1")
a1 = tf.nn.relu(tf.matmul(X, W1) + b1)
W2 = tf.placeholder(tf.float32, name="W2")
b2 = tf.placeholder(tf.float32, name="b2")
a2 = tf.nn.relu(tf.matmul(a1, W2) + b2)
W3 = tf.placeholder(tf.float32, name="W3")
b3 = tf.placeholder(tf.float32, name="b3")
y_hat = tf.matmul(a2, W3) + b3
tf.summary.FileWriter("logs", g).close()
In [3]:
g = tf.Graph()
with g.as_default():
X = tf.placeholder(tf.float32, name="X")
with tf.name_scope("Layer1"):
W1 = tf.placeholder(tf.float32, name="W1")
b1 = tf.placeholder(tf.float32, name="b1")
a1 = tf.nn.relu(tf.matmul(X, W1) + b1)
with tf.name_scope("Layer2"):
W2 = tf.placeholder(tf.float32, name="W2")
b2 = tf.placeholder(tf.float32, name="b2")
a2 = tf.nn.relu(tf.matmul(a1, W2) + b2)
with tf.name_scope("Layer3"):
W3 = tf.placeholder(tf.float32, name="W3")
b3 = tf.placeholder(tf.float32, name="b3")
y_hat = tf.matmul(a2, W3) + b3
tf.summary.FileWriter("logs", g).close()
In [ ]: