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

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)
主站蜘蛛池模板: 山西省| 和田市| 法库县| 仙居县| 台南县| 彭泽县| 唐海县| 安康市| 南通市| 八宿县| 霍山县| 阳信县| 阿克苏市| 上犹县| 玉龙| 永春县| 资中县| 基隆市| 五台县| 宁海县| 石林| 白银市| 平度市| 淮安市| 克山县| 牙克石市| 乌拉特前旗| 南丰县| 营口市| 岗巴县| 清水河县| 时尚| 扶绥县| 夏邑县| 沂水县| 左云县| 疏勒县| 荆州市| 峡江县| 大连市| 茶陵县|