Skip to content

Commit

Permalink
Update code doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lettercode committed Jun 15, 2024
1 parent 1335cb8 commit e39620e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ncps/keras/cfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ def __init__(
Examples::
>>> from ncps.tf import CfC
>>> from ncps.keras import CfC
>>>
>>> rnn = CfC(50)
>>> x = keras.random.uniform((2, 10, 20)) # (B,L,C)
>>> y = keras.layers.RNN(x)
>>> y = rnn(x)
:param units: Number of hidden units
:param mixed_memory: Whether to augment the RNN by a `memory-cell <https://arxiv.org/abs/2006.04418>`_ to help learn long-term dependencies in the data (default False)
Expand Down
6 changes: 3 additions & 3 deletions ncps/keras/ltc.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ def __init__(
>>> from ncps.keras import LTC
>>>
>>> rnn = LTC(50)
>>> x = tf.random.uniform((2, 10, 20)) # (B,L,C)
>>> x = keras.random.uniform((2, 10, 20)) # (B,L,C)
>>> y = rnn(x)
.. Note::
For creating a wired `Neural circuit policy (NCP) <https://publik.tuwien.ac.at/files/publik_292280.pdf>`_ you can pass a `ncps.wirings.NCP` object instead of the number of units
Examples::
>>> from ncps.tf import LTC
>>> from ncps.keras import LTC
>>> from ncps.wirings import NCP
>>>
>>> wiring = NCP(10, 10, 8, 6, 6, 4, 4)
>>> rnn = LTC(wiring)
>>> x = tf.random.uniform((2, 10, 20)) # (B,L,C)
>>> x = keras.random.uniform((2, 10, 20)) # (B,L,C)
>>> y = rnn(x)
:param units: Wiring (ncps.wirings.Wiring instance) or integer representing the number of (fully-connected) hidden units
Expand Down
4 changes: 2 additions & 2 deletions ncps/keras/ltc_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ def __init__(
. Note::
This is an RNNCell that process single time-steps.
To get a full RNN that can process sequences,
see `ncps.tf.LTC` or wrap the cell with a `keras.layers.RNN <https://www.tensorflow.org/api_docs/python/tf/keras/layers/RNN>`_.
see `ncps.keras.LTC` or wrap the cell with a `keras.layers.RNN <https://www.tensorflow.org/api_docs/python/tf/keras/layers/RNN>`_.
Examples::
>>> import ncps
>>> from ncps.tf import LTCCell
>>> from ncps.keras import LTCCell
>>>
>>> wiring = ncps.wirings.Random(16, output_dim=2, sparsity_level=0.5)
>>> cell = LTCCell(wiring)
Expand Down

0 comments on commit e39620e

Please sign in to comment.