본문 바로가기

implement_ml_models/RNN

implement_LSTM(forget_gate)

삭제 게이트는 통과할 정보와 억제할 정보를 결정한다. 

  def forget_gate(self, input_x, input_h, output):
    activation = Activation()

    w_xf = np.random.rand(output.shape[0], input_x.shape[0])
    w_hf = np.random.rand(output.shape[0], output.shape[1])
    b_f = np.random.rand(output.shape[0],1)
    
    self.w_xf.append(w_xf)
    self.w_hf.append(w_hf)
    self.b_f.append(b_f)

    hidden_input = w_xf@input_x + w_hf@input_h + b_f
    
    return activation.sigmoid_fun(hidden_input)

 

'implement_ml_models > RNN' 카테고리의 다른 글

implement_LSTM(cell_state)  (0) 2022.12.13
implement_LSTM(output_gate)  (0) 2022.12.13
implement_LSTM(input_gate)  (0) 2022.12.13
implement_delta(before_w)(2)  (0) 2022.12.05
implement_delta(input_w)(2)  (0) 2022.12.05