(self, inputs_shape)
| 3120 | return self._num_units |
| 3121 | |
| 3122 | def build(self, inputs_shape): |
| 3123 | if tensor_shape.dimension_value(inputs_shape[1]) is None: |
| 3124 | raise ValueError( |
| 3125 | "Expected inputs.shape[-1] to be known, saw shape: %s" % inputs_shape) |
| 3126 | |
| 3127 | input_depth = tensor_shape.dimension_value(inputs_shape[1]) |
| 3128 | # pylint: disable=protected-access |
| 3129 | self._kernel_w = self.add_variable( |
| 3130 | "%s_w" % rnn_cell_impl._WEIGHTS_VARIABLE_NAME, |
| 3131 | shape=[input_depth, self._num_units]) |
| 3132 | self._kernel_u = self.add_variable( |
| 3133 | "%s_u" % rnn_cell_impl._WEIGHTS_VARIABLE_NAME, |
| 3134 | shape=[1, self._num_units], |
| 3135 | initializer=init_ops.random_uniform_initializer( |
| 3136 | minval=-1, maxval=1, dtype=self.dtype)) |
| 3137 | self._bias = self.add_variable( |
| 3138 | rnn_cell_impl._BIAS_VARIABLE_NAME, |
| 3139 | shape=[self._num_units], |
| 3140 | initializer=init_ops.zeros_initializer(dtype=self.dtype)) |
| 3141 | # pylint: enable=protected-access |
| 3142 | |
| 3143 | self.built = True |
| 3144 | |
| 3145 | def call(self, inputs, state): |
| 3146 | """IndRNN: output = new_state = act(W * input + u * state + B).""" |
nothing calls this directly
no test coverage detected