Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions braintrace/_algorithm/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,16 @@


class EligibilityTrace(brainstate.ShortTermState):
"""
The state for storing the eligibility trace during the computation of
online learning algorithms.
"""Store the eligibility trace carried by an online-learning algorithm.

Parameters
----------
value : PyTree[ArrayLike]
The initial eligibility-trace value.
name : str, optional
The state name.
**metadata : Any
Additional metadata stored with the state.

Examples
--------
Expand Down
9 changes: 5 additions & 4 deletions braintrace/_algorithm/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class SequenceDriverMixin:
The learner's ``vjp_method``, or ``None`` if it has none.

``_seq_vjp_method`` is a hook rather than a ``getattr`` on the driver
because :class:`brainstate.nn.Vmap` defines no ``__getattr__`` and so does
because ``brainstate.nn.Vmap`` defines no ``__getattr__`` and so does
not forward ``vjp_method`` from ``.module``. Reading the attribute off the
driver object would silently yield ``None`` for every vmapped learner and
bypass the window-mode validation entirely.
Expand Down Expand Up @@ -285,7 +285,7 @@ def etrace_grad(
Returns
-------
grads or tuple
Mirrors :func:`brainstate.transform.grad`: ``grads``,
Mirrors ``brainstate.transform.grad``: ``grads``,
``(grads, losses)``, ``(grads, aux)`` or ``(grads, losses, aux)``.

Raises
Expand Down Expand Up @@ -537,7 +537,7 @@ def body(*slices):


class ETraceVmap(SequenceDriverMixin, brainstate.nn.Vmap):
"""A :class:`brainstate.nn.Vmap` that carries the sequence drivers.
"""Provide sequence drivers on a ``brainstate.nn.Vmap`` wrapper.

Returned by ``braintrace.compile(..., vmap=True)`` so the call site is
identical in batched and unbatched mode. Because it *is* a
Expand All @@ -555,7 +555,8 @@ class ETraceVmap(SequenceDriverMixin, brainstate.nn.Vmap):
would drive the **unbatched** learner and silently produce per-lane-wrong
results.

Window mode is refused here -- see :meth:`SequenceDriverMixin._seq_check_window`.
Window mode is refused here -- see
:meth:`SequenceDriverMixin.etrace_grad`.
"""
__module__ = 'braintrace'

Expand Down
4 changes: 2 additions & 2 deletions braintrace/_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def compile(
``trace_factorization`` and is forwarded to the constructor, so any
coordinate admitted by the compatibility matrix can be compiled
without a named preset.
*example_inputs
*example_inputs : Any
Example call inputs (arrays / :class:`SingleStepData` /
:class:`MultiStepData`) matching what ``learner.update(...)`` will
receive. At least one is required.
Expand Down Expand Up @@ -184,7 +184,7 @@ def compile(
``result.module.report``). Requires a model whose hidden states are all
(re)created in ``init_all_states``; models holding construction-time
states may raise ``brainstate.transform.BatchAxisError``.
**options
**options : Any
Forwarded to the algorithm constructor. See *Algorithm options* below.

Returns
Expand Down
3 changes: 3 additions & 0 deletions docs/_templates/classtemplate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@

.. autoclass:: {{ name }}
:members:
:exclude-members: __init__

.. automethod:: {{ name }}.__init__
10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.DNI.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.D_RTRL.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.EProp.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.ETraceAlgorithm.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.ETraceConfig.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.ETraceVjpAlgorithm.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.ETraceVmap.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.EligibilityTrace.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.FixedRandomFeedback.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.IODimVjpAlgorithm.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.KappaFilter.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.OSTLFeedforward.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.OSTLRecurrent.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.ParamDimVjpAlgorithm.rst

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.SequenceDriverMixin.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.SnAp.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.SyntheticGradient.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.ThreeFactor.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.UORO.rst

This file was deleted.

9 changes: 0 additions & 9 deletions docs/apis/algorithm_details/braintrace.compile.rst

This file was deleted.

10 changes: 0 additions & 10 deletions docs/apis/algorithm_details/braintrace.pp_prop.rst

This file was deleted.

This file was deleted.

Loading