swift-apis
swift-apis copied to clipboard
RNNCell output: `Output` and `State`?
There's something that's really bugging me about the RNNCell protocol: that TimeStepOutput
is separate from the State
. RNN Cells, at least as far as I've seen them in other languages, will always only return the hidden state, and it's up to another Dense layer (or some counterpart) to make process the hidden state.
In that case, why keep them separate? Why not just say that RNN Cells just return a State
?
(please do let me know if I'm overlooking something)
If we use State
as Output
, both the output and the next state will have to be included as part of State
. However, it is not ideal to always pass the last hidden state and the last output as part of Input
. @jekbradbury What do you think?
The thing that I’m wondering is why do we need ‘Output’ in the first place? RNN Cells only return States, if I’m not mistaken?
I personally believe that the separation of semantics between State
and Output
is nice, but indeed not super necessary. It probably eventually comes down to how RNN cells are most frequently used and I think that in deep learning it's very often to have distinct notions of state and output and many people think of them that way. For this reason I would lean more towards keeping them separate.