我知道递归神经网络或 RNN 背后的理论,但我对它的实现感到困惑。这是我从网上得到的一个rnn方程,

我试图在 python 的 numpy 中单独编码前向传播
import numpy as np
outputs = 5
inputs = 3
# Input value
# (batch_size,seq_len, vocab_len)
X = np.ones((10,3,3))
# Initializing rnn weights and hidden states
Wxh = np.random.rand(outputs,inputs)
Whh = np.random.rand(outputs,inputs)
Why = np.random.rand(outputs,inputs)
h = np.zeros((1,inputs))
# Forward propagation
def rnn(x,h):
h = np.tanh(np.dot(Whh,h.T) + np.dot(Wxh,x.T))
y = np.dot(Why,h.T)
return y,h
for i in X:
_,h = rnn(i,h)
但我收到广播错误。我们如何实现 rnn 的前向传播?