You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want use initial_state in this way but get an error: AttributeError: 'Transformed' object has no attribute 'init_hidden_state'
What is the best way to to this?
import haiku as hk
class RNN(hk.Module):
def __init__(self, hidden_size=4, name=None):
super().__init__(name=name)
self.rnn = hk.LSTM(hidden_size)
def __call__(self, h, x):
out, h = self.rnn(x, h)
return h, out
def init_hidden_state(self, batch_size=1):
return self.rnn.initial_state(batch_size)
model = hk.without_apply_rng(hk.transform(lambda h, x: RNN(4)(h, x)))
h = model.init_hidden_state(1)
The text was updated successfully, but these errors were encountered:
qlan3
changed the title
How to use reinitialize the hidden states of RNNs?
How to reinitialize the hidden states of RNNs?
Dec 22, 2022
I want use
initial_state
in this way but get an error: AttributeError: 'Transformed' object has no attribute 'init_hidden_state'What is the best way to to this?
The text was updated successfully, but these errors were encountered: