MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _process_inputs

Method _process_inputs

tensorflow/python/keras/layers/recurrent.py:777–804  ·  view source on GitHub ↗
(self, inputs, initial_state, constants)

Source from the content-addressed store, hash-verified

775 return output
776
777 def _process_inputs(self, inputs, initial_state, constants):
778 # input shape: `(samples, time (padded with zeros), input_dim)`
779 # note that the .build() method of subclasses MUST define
780 # self.input_spec and self.state_spec with complete input shapes.
781 if (isinstance(inputs, collections.Sequence)
782 and not isinstance(inputs, tuple)):
783 # get initial_state from full input spec
784 # as they could be copied to multiple GPU.
785 if not self._num_constants:
786 initial_state = inputs[1:]
787 else:
788 initial_state = inputs[1:-self._num_constants]
789 constants = inputs[-self._num_constants:]
790 if len(initial_state) == 0:
791 initial_state = None
792 inputs = inputs[0]
793 if initial_state is not None:
794 pass
795 elif self.stateful:
796 initial_state = self.states
797 else:
798 initial_state = self.get_initial_state(inputs)
799
800 if len(initial_state) != len(self.states):
801 raise ValueError('Layer has ' + str(len(self.states)) +
802 ' states but was passed ' + str(len(initial_state)) +
803 ' initial states.')
804 return inputs, initial_state, constants
805
806 def reset_states(self, states=None):
807 if not self.stateful:

Callers 3

callMethod · 0.95
callMethod · 0.80
callMethod · 0.80

Calls 1

get_initial_stateMethod · 0.95

Tested by

no test coverage detected