This is very nit-picky, but I happened to look at the RNN constructor and see that a ValueError
is raised when, by definition, the exception should be a TypeError
, right?
https://github.com/keras-team/keras/blob/764ed95651c1c7dfa71ca523287f6eeb514ccf77/keras/src/layers/rnn/rnn.py#L221-L225
From TypeError: python org docs
exception TypeError Raised when an operation or function is applied to an object of inappropriate type. The associated value is a string giving details about the type mismatch.
and ValueError: python org docs
exception ValueError Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more precise exception such as IndexError.
The state_size
argument in __init__(...)
must be one of the specified types. The currently raised ValueError
implies that state_size
is the correct type but incorrect value, but that implication is directly contradicted by "state_size must be an integer, or a list/tuple of integers".
This is an extremely minor fix, and am happy to open a PR to do so, but wanted to open an issue first! I appreciate any feedback!