PacktPublishing/Hands-On-Meta-Learning-with-Python

Spelling Error

Closed this issue · 0 comments

"4.5 Building Relation Network Using Tensorflow.ipynb" in Chapter04

def relation_function(x):
    w1 = tf.Variable(tf.truncated_normal([2,3]))
    b1 = tf.Variable(tf.truncated_normal([3]))
    
    w2 = tf.Variable(tf.truncated_normal([3,5]))
    b2 = tf.Variable(tf.truncated_normal([5]))
    
    w3 = tf.Variable(tf.truncated_normal([5,1]))
    b3 = tf.Variable(tf.truncated_normal([1]))
    
    #layer1
    z1 = (tf.nn.xw_plus_b(x,w1,b1))
    a1 = tf.nn.relu(z1)
    
    #layer2
    z2 = tf.nn.xw_plus_b(a1,w2,b2)
    a2 = tf.nn.relu(z2)
    
    #layer3
    z3 = tf.nn.xw_plus_b(z2,w3,b3)    # z3 = tf.nn.xw_plus_b(a2,w3,b3)

    #output
    y = tf.nn.sigmoid(z3)
    
    return y

Unless this line of code "a2 = tf.nn.relu(z2)" is useless.