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

  • Deep Learning Essentials
  • Wei Di Anurag Bhardwaj Jianing Wei
  • 102字
  • 2021-06-30 19:17:53

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)
主站蜘蛛池模板: 项城市| 炎陵县| 烟台市| 周至县| 汉源县| 桐柏县| 海口市| 阳新县| 溧阳市| 漳平市| 遵化市| 舟山市| 齐齐哈尔市| 恩施市| 鄂伦春自治旗| 永吉县| 罗山县| 松江区| 日土县| 浦东新区| 沅江市| 洛川县| 盐城市| 祥云县| 司法| 扶余县| 祁东县| 福贡县| 昭通市| 河东区| 左云县| 兴安盟| 竹北市| 东光县| 宝应县| 广宗县| 临安市| 大田县| 无极县| 乌鲁木齐县| 交口县|