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

  • 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)
主站蜘蛛池模板: 汽车| 浦北县| 郧西县| 龙胜| 西宁市| 湄潭县| 涿鹿县| 科尔| 玛纳斯县| 水城县| 宁安市| 轮台县| 乐业县| 吕梁市| 普安县| 漳浦县| 高台县| 甘孜县| 苍南县| 崇州市| 鸡西市| 金堂县| 巴林左旗| 新龙县| 海淀区| 福海县| 遂昌县| 平凉市| 彰化市| 侯马市| 西平县| 东方市| 万州区| 克拉玛依市| 阿城市| 宜昌市| 龙海市| 孟州市| 民权县| 福鼎市| 九龙县|