| 2780 | return self._num_units |
| 2781 | |
| 2782 | def build(self, inputs_shape): |
| 2783 | if tensor_shape.dimension_value(inputs_shape[1]) is None: |
| 2784 | raise ValueError( |
| 2785 | "Expected inputs.shape[-1] to be known, saw shape: %s" % inputs_shape) |
| 2786 | |
| 2787 | input_depth = tensor_shape.dimension_value(inputs_shape[1]) |
| 2788 | |
| 2789 | # pylint: disable=protected-access |
| 2790 | self._kernel = self.add_variable( |
| 2791 | rnn_cell_impl._WEIGHTS_VARIABLE_NAME, |
| 2792 | shape=[input_depth, 4 * self._num_units]) |
| 2793 | # pylint: enable=protected-access |
| 2794 | self._bias = self.add_variable( |
| 2795 | rnn_cell_impl._BIAS_VARIABLE_NAME, # pylint: disable=protected-access |
| 2796 | shape=[2 * self._num_units], |
| 2797 | initializer=init_ops.zeros_initializer) |
| 2798 | |
| 2799 | self._built = True |
| 2800 | |
| 2801 | def call(self, inputs, state): |
| 2802 | """Simple recurrent unit (SRU) with num_units cells.""" |