Guest User

Untitled

a guest
Dec 14th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. class BasicRNNCell(RNNCell):
  2. """The most basic RNN cell.
  3. Args:
  4. num_units: int, The number of units in the RNN cell.
  5. activation: Nonlinearity to use. Default: `tanh`.
  6. reuse: (optional) Python boolean describing whether to reuse variables
  7. in an existing scope. If not `True`, and the existing scope already has
  8. the given variables, an error is raised.
  9. """
  10.  
  11. def __init__(self, num_units, activation=None, reuse=None):
  12. super(BasicRNNCell, self).__init__(_reuse=reuse)
  13. self._num_units = num_units
  14. self._activation = activation or math_ops.tanh
  15.  
  16. @property
  17. def state_size(self):
  18. return self._num_units
  19.  
  20. @property
  21. def output_size(self):
  22. return self._num_units
  23.  
  24. def call(self, inputs, state):
  25. """Most basic RNN: output = new_state = act(W * input + U * state + B)."""
  26. output = self._activation(_linear([inputs, state], self._num_units, True))
  27. return output, output
Add Comment
Please, Sign In to add comment