File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,11 @@ def __init__(self,
36
36
self .supports_masking = False
37
37
self .input_spec = [InputSpec (ndim = 3 )]
38
38
if hasattr (self .cell .state_size , '__len__' ):
39
- self .state_spec = [InputSpec (shape = (None , dim ))
40
- for dim in self .cell .state_size ]
39
+ state_size = self .cell .state_size
41
40
else :
42
- self .state_spec = InputSpec (shape = (None , self .cell .state_size ))
41
+ state_size = [self .cell .state_size ]
42
+ self .state_spec = [InputSpec (shape = (None , dim ))
43
+ for dim in state_size ]
43
44
self .constants_spec = None
44
45
self ._states = None
45
46
self ._num_constants = None
Original file line number Diff line number Diff line change @@ -454,9 +454,10 @@ def build(self, input_shape):
454
454
# initial_state was passed in call, check compatibility
455
455
if not [spec .shape [- 1 ] for spec in self .state_spec ] == state_size :
456
456
raise ValueError (
457
- 'an initial_state was passed that is not compatible with'
458
- ' cell.state_size, state_spec: {}, cell.state_size:'
459
- ' {}' .format (self .state_spec , self .cell .state_size ))
457
+ 'An initial_state was passed that is not compatible with '
458
+ '`cell.state_size`. Received `state_spec`={}; '
459
+ 'However `cell.state_size` is '
460
+ '{}' .format (self .state_spec , self .cell .state_size ))
460
461
else :
461
462
self .state_spec = [InputSpec (shape = (None , dim ))
462
463
for dim in state_size ]
You can’t perform that action at this time.
0 commit comments