Tensorflow細節 P212 迴圈神經網路

2022-05-08 18:03:15 字數 894 閱讀 7933

本節的迴圈神經網路一圖足以說明

# 定義rnn的引數

# 以下兩個本來是像這樣分開的,但是在運算時合併了

w_cell_state = np.asarray([[0.1, 0.2], [0.3, 0.4]])

w_cell_input = np.asarray([0.5, 0.6])

b_cell = np.asarray([0.1, -0.1])

w_output = np.asarray([[1.0], [2.0]])

b_output = 0.1

# 執行前向傳播過程

for i in range(len(x)):

before_activation = np.dot(state, w_cell_state) + x[i] * w_cell_input + b_cell

state = np.tanh(before_activation)

final_output = np.dot(state, w_output) + b_output

print("before activation: ", before_activation)

print("state: ", state)

print("output: ", final_output)

計算結果:

Tensorflow細節 P54 變數

1 首先複習前面所學知識 1 g tf.graph 2 別忘了初始化時的initializer 3 with tf.name scope generate constant x tf.constant 0.7,0.9 name x 這個東西發現沒球用 4 最好是用with tf.variable s...

Tensorflow細節 P190 輸入檔案佇列

以下 要學會幾個地方 1 filename data.tfrecords 5d of 5d i,num shards 這個東西就是要會data.tfrecords 5d of 5d兩個.5d,2 記住這兩個操作writer tf.python io.tfrecordwriter filename 與...

Tensorflow中PRelu實現細節

本次介紹prelu啟用函式,方法來自於何凱明 delving deep into rectifiers surpassing human level performance on imagenet classification prelu parametric rectified linear un...