def sigmoid(x):
return 1.0 / (1.8 + np.exp(-x))
class GRU:
def __init__(self, input_size=input size, hidden_size-hidden_size)
#体重みとバイアスの初期化
self.w_z, self.wr, self.w.c = \
[ (ア) ] for i in range(3))
self.b_z, self.bur, self.b_c = \
(np.random.randn(hidden_size) for i in range(3))
def forward(self, x, h_prev):
inputs - np.concatenate([x, h_prev], axis=0)
z = sigmoid(np.matmul(inputs, self.w_z) + self.b_z)
r = sigmoid(np.matmul(inputs, self.w_r) + self.b_r)
_c = np.concatenate([ (イ) ])
c = np.tanh(np.matmul(_c, self.w_c) + self.b_c)
h_next = [ (ウ) ]
return h_next
# GRUを使用。
h_prev = np.random.randn(hidden_size)
x_t = np.random.randn(input_size)
gru = GRU(input_size, hidden_size)
gru.forward(x_t, h_prev)
META
2020年8月22日土曜日
Shuryo09codeテスト
https://www.wabiapp.com/WebTools/SyntaxHighlighterTextMaker/
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿