I have an issue about a tuple for storing an activation in a[:,:,t]
TypeError Traceback (most recent call last)
in
9 parameters_tmp[‘by’] = np.random.randn(2, 1)
10
—> 11 a_tmp, y_pred_tmp, caches_tmp = rnn_forward(x_tmp, a0_tmp, parameters_tmp)
12 print(“a[4][1] = \n”, a_tmp[4][1])
13 print(“a.shape = \n”, a_tmp.shape)
in rnn_forward(x, a0, parameters)
43 a_next, yt_pred, cache = rnn_cell_forward(x[:,:,t], a_next, parameters)
44 # Save the value of the new “next” hidden state in a (≈1 line)
—> 45 a[:,:,t] = a_next
46 # Save the value of the prediction in y (≈1 line)
47 y_pred[:,:,t] = yt_pred
TypeError: ‘tuple’ object does not support item assignment
I tried storing a_next into a[:,:,t].
for additional information. I am getting a_next from rnn_cell_forward in which I am using the rnn_cell_forward function with (x[:,:,t], a_next, parameters) as arguments(this passes, may not be right i guess). The original arguments in the original function are xt, a_prev, parameters. I have altered the arguments a little to be able to put in what I have access to.
I note that a_prev and a_next are not the same but I do not have any a_prev, there aren’t too many moving parts in this code block that could be used instead of a_prev besides a_next and a0. Maybe if I could do some form of a_next at a t-1 time point to get a psedo ‘a_prev’ to put into rnn_cell_forward to give me a correct a_next and therefore not error when storing that in a[:,:,t].
These are just my thoughts there might be another reason I can’t store something in a[:,:,t] as a tuple. Any thoughts are welcome.
Thanks