def recurrent_as_activation_function(self, Wix, h_tm1, c_tm1):
""" Implement the recurrent unit as an activation function. This function is called by self.__init__().
:param Wix: it equals to W^{hx}x_{t}, as it does not relate with recurrent, pre-calculate the value for fast computation
:type Wix: matrix
:param h_tm1: contains the hidden activation from previous time step
:type h_tm1: matrix, each row means a hidden activation vector of a time step
:param c_tm1: this parameter is not used, just to keep the interface consistent with LSTM
:returns: h_t is the hidden activation of current time step
"""
h_t = T.tanh(Wix + T.dot(h_tm1, self.W_hi) + self.b_i) #
c_t = h_t
return h_t, c_t
评论列表
文章目录