官术网_书友最值得收藏!

Forward propagation

Forward propagation is basically calculating the input data multiplied by the networks’ weight plus the offset, and then going through the activation function to the next layer:

An example code block using TensorFlow can be written as follows:

# dimension variables
dim_in = 2
dim_middle = 5
dim_out = 1

# declare network variables
a_0 = tf.placeholder(tf.float32, [None, dim_in])
y = tf.placeholder(tf.float32, [None, dim_out])

w_1 = tf.Variable(tf.random_normal([dim_in, dim_middle]))
b_1 = tf.Variable(tf.random_normal([dim_middle]))
w_2 = tf.Variable(tf.random_normal([dim_middle, dim_out]))
b_2 = tf.Variable(tf.random_normal([dim_out]))

# build the network structure
z_1 = tf.add(tf.matmul(a_0, w_1), b_1)
a_1 = sigmoid(z_1)
z_2 = tf.add(tf.matmul(a_1, w_2), b_2)
a_2 = sigmoid(z_2)
主站蜘蛛池模板: 昂仁县| 平潭县| 肥东县| 绩溪县| 绥芬河市| 民丰县| 南召县| 汝城县| 裕民县| 云梦县| 青龙| 竹北市| 佛坪县| 天全县| 阿拉善右旗| 眉山市| 鞍山市| 洛扎县| 海兴县| 耿马| 清徐县| 灌南县| 突泉县| 射洪县| 新蔡县| 新竹县| 托克逊县| 黎平县| 桐梓县| 金坛市| 大连市| 平山县| 大兴区| 民勤县| 弥勒县| 周口市| 曲阜市| 金门县| 怀远县| 五家渠市| 堆龙德庆县|