3.6 Compute the output of each neuron in our network

In [21]:
x1 = np.linspace(-2,2,50)
x2 = np.linspace(-2,2,50)
x3 = np.linspace(-1,1,50*50)

result = np.zeros((50*50,3)) 

out11 = np.zeros((50*50, 1))
out12 = np.zeros((50*50, 1))
out13 = np.zeros((50*50, 1))
out14 = np.zeros((50*50, 1))
out15 = np.zeros((50*50, 1))
out16 = np.zeros((50*50, 1))
out17 = np.zeros((50*50, 1))
out18 = np.zeros((50*50, 1))

out21 = np.zeros((50*50, 1))

for i in range(len(x1)):
    for j in range(len(x2 )):
        # Input layer
        n1 = np.dot(weights0[0],x1[i]) + np.dot(weights0[1],x1[j]) + biases0
        a1 = ReLU(n1)
        # Output layer
        n2 = np.dot(weights1[:,0],a1) + biases1
        a2 = sigmoid(n2)

        result[i*50+j,0 ] = x1[i]
        result[i*50+j, 1] = x2[j]

        out11[i*50+j] = a1[0]
        out12[i*50+j] = a1[1]
        out13[i*50+j] = a1[2]
        out14[i*50+j] = a1[3]
        out15[i*50+j] = a1[4]
        out16[i*50+j] = a1[5]
        out17[i*50+j] = a1[6]
        out18[i*50+j] = a1[7]

        out21[i*50+j] = a2