Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #2852

Merged
merged 124 commits into from
Dec 15, 2023
Merged

Devel #2852

merged 124 commits into from
Dec 15, 2023

Conversation

kmantel
Copy link
Collaborator

@kmantel kmantel commented Dec 5, 2023

No description provided.

dependabot bot and others added 30 commits July 27, 2023 02:39
• inputport.py
  _parse_port_specific_specs(): fix bug in which COMBINE was not parsed when specified in an InputPort specification dict (though still some weirdness in passing spec through to constructor, requiring function assignment in place)

• port.py
  _parse_port_spec():  add passing of Context.string for local handling based on caller (e.g., warning messages)
• EMstoragemechanism.py
  - refactor memory_matrix to use learning_signals

 • emcomposition.py
   - refactor to use memory_matrix of storage_node if that is implemented

Co-authored-by: jdcpni <pniintel55>
…by 40x

It's still enough to recover the parameters and reduces test time
significantly.

Signed-off-by: Jan Vesely <[email protected]>
Reduce the number of estimates by a factor of 40, it's enough to pass the test and it significantly reduces test running time.
Provide expected results for different optimization methods
* origin/devel:
  tests/ParameterEstimationComposition: Reduce the number of estimates by 40x
  tests/ParameterEstimationComposition: Provide expected result instead of relying on tolerance
  requirements: update dill requirement from <0.3.7 to <0.3.8 (#2743)
  Feat/em composition refactor learning mech (#2754)
  Fix/input port combine (#2755)
  requirements: update beartype requirement from <0.15.0 to <0.16.0 (#2744)
Updates the requirements on [numpy](https://github.com/numpy/numpy) to permit version 1.24.4
- [Release notes](https://github.com/numpy/numpy/releases)
- [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst)
- [Commits](numpy/numpy@v1.24.3...v1.24.4)

---
updated-dependencies:
- dependency-name: numpy
  dependency-type: direct:production
...
…rt" in warning message

Allocation samples are applied to output ports.

Signed-off-by: Jan Vesely <[email protected]>
…dices

Remove duplicate index query.

Signed-off-by: Jan Vesely <[email protected]>
…igning control allocation

Matches Python semantics.

Signed-off-by: Jan Vesely <[email protected]>
… saved values

This allows to call the benchmark fixtures unconditionally.

Signed-off-by: Jan Vesely <[email protected]>
…ferWithCosts when computing net_outcome

Drop allocation vector structure from net_outcome argument list.
Enable tests of different cost combinations.

Signed-off-by: Jan Vesely <[email protected]>
The tests were almost identical but for the setting of the controller.

Signed-off-by: Jan Vesely <[email protected]>
…ithCosts (#2761)

Execute OCM ports when setting an allocation.
Reuse calculated costs from TransferWithCosts.
Drop "allocation" parameter to net_outcome.
Consolidate model_based_ocm tests.
Do not reuse variable names for different types.
Use 'Callable' instead of 'callable' to annotate a callable argument type.
* [skip ci]

• combinationfunctions.py
  LinearCombination.derivative: return Jacobian for first item in variable[0] relative to others

• composition.py
  _create_non_terminal_backprop_learning_components(): modify to handle multiple args in output_source for learning_function and learning_mechanism

* [skip ci]

• combinationfunctions.py
  LinearCombination.derivative: return Jacobian for first item in variable[0] relative to others

• composition.py
  _create_non_terminal_backprop_learning_components(): modify to handle multiple args in output_source for learning_function and learning_mechanism

* [skip ci]

* [skip ci]

• composition.py
  - _check_for_existing_projections():
    augment to search over all input_ports and output_ports;
    NOTE: if a mechanism is specified as sender and/or receiver, then any existing Projection between the two (i.e., between any pair of input_port/output_ports) will be returned as existing;  to support multiple projections (between different pairs of Ports), must specify Ports explicitly

* [skip ci]

* -
The builder context helpers reset random state if the seed has changed.

Signed-off-by: Jan Vesely <[email protected]>
…rs in compiled parametrrs

The only provide user interaction, similar to Shared and Function
parameters.

Signed-off-by: Jan Vesely <[email protected]>
"random_draw", DriftDiffusionIntegrator; only used as a helper for mdf tests.
"key_size", "val_size", "max_entries", DictionaryMemory; structural parameters
"per_item", TransferFunction; structural parameter
"randomization_dimension", GridSearch; user only parameter, not used in compiled code
"save_values", "save_samples", GridSearch;  structural parameters not used in compiled code
"max_iterations", GridSearch; not used by compilation, the number of iterations is known in advance

Signed-off-by: Jan Vesely <[email protected]>
… for cost and intensity parameters

These are output parameters that receive new values and can have history
enabled.

Signed-off-by: Jan Vesely <[email protected]>
Use the get_random_state_ptr helper in the GridSearch function instead of accessing the random state directly.
The helper handles reseeding the random state if the seed has changed.
Remove unneeded parameters from compiled structures; read-only parameters with custom getters are user-only and not used in compilation.
* [skip ci]

• combinationfunctions.py
  LinearCombination.derivative: return Jacobian for first item in variable[0] relative to others

• learningmechanism.py
  - add support for COVARIATES
  - make error_sources and covariates_sources Parameters

• composition.py
  _create_non_terminal_backprop_learning_components(): modify to handle multiple args in output_source for learning_function and learning_mechanism

  _create_non_terminal_backprop_learning_components():  refactored to use covariates

  - _check_for_existing_projections():
    augment to search over all input_ports and output_ports;
    NOTE: if a mechanism is specified as sender and/or receiver, then any existing Projection between the two (i.e., between any pair of input_port/output_ports) will be returned as existing;  to support multiple projections (between different pairs of Ports), must specify Ports explicitly

• component.py
  add error_sources and covariates_sources to blacklis for compilation (since they are lists of PNL objects) rather than ---------

Co-authored-by: jdcpni <pniintel55>
• combinationfunctions.py
  - LinearCombination: fix bug in jacobian

• integratorfunctions.py
  - DriftOnASphereIntegrator: fix bug in formatting of variable
Add DOT_PRODUCT testing.
Drop references to PEARSON and ANGLE, the implementations are no longer
available.
Drop 'fail' parameter, it is no longer needed.
Convert test data to a list of pytest.param-s including ids.
Use reduced precision only for the COSINE metric or fp32 mode.

Signed-off-by: Jan Vesely <[email protected]>
Include all constructor attributes, not just conditions:

- default_execution_id
- mode
- default_absolute_time_unit

For example, setting of Scheduler.mode using argument scheduling_mode to
Composition.run would not persist across Scheduler rebuilds.
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

* requirements: update beartype requirement from <0.15.0 to <0.16.0 (#2744)

* Fix/input port combine (#2755)

• inputport.py
  _parse_port_specific_specs(): fix bug in which COMBINE was not parsed when specified in an InputPort specification dict (though still some weirdness in passing spec through to constructor, requiring function assignment in place)

• port.py
  _parse_port_spec():  add passing of Context.string for local handling based on caller (e.g., warning messages)

* Feat/em composition refactor learning mech (#2754)

• EMstoragemechanism.py
  - refactor memory_matrix to use learning_signals

 • emcomposition.py
   - refactor to use memory_matrix of storage_node if that is implemented

Co-authored-by: jdcpni <pniintel55>

* requirements: update dill requirement from <0.3.7 to <0.3.8 (#2743)

* tests/ParameterEstimationComposition: Provide expected result instead of relying on tolerance

Signed-off-by: Jan Vesely <[email protected]>

* tests/ParameterEstimationComposition: Reduce the number of estimates by 40x

It's still enough to recover the parameters and reduces test time
significantly.

Signed-off-by: Jan Vesely <[email protected]>

---------

Signed-off-by: Jan Vesely <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jdcpni <[email protected]>
Co-authored-by: Jan Vesely <[email protected]>
Resolve all differences in favor of devel. master changes are stale
because they mirror old commits on devel.

* master:
  tests/ParameterEstimationComposition: Reduce the number of estimates by 40x
  tests/ParameterEstimationComposition: Provide expected result instead of relying on tolerance
  requirements: update dill requirement from <0.3.7 to <0.3.8 (#2743)
  Feat/em composition refactor learning mech (#2754)
  Fix/input port combine (#2755)
  requirements: update beartype requirement from <0.15.0 to <0.16.0 (#2744)
Copy link
Collaborator

@jdcpni jdcpni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good by me

Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11-x64):

diff -r docs-base/AutoAssociativeLearningMechanism.html docs-head/AutoAssociativeLearningMechanism.html
387c387
< If it is <code class="xref any docutils literal notranslate"><span class="pre">None</span></code>, then the <code class="xref any docutils literal notranslate"><span class="pre">learning_rate</span></code> specified for the System to which the
---
> If it is <code class="xref any docutils literal notranslate"><span class="pre">None</span></code>, then the <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learning_rate" title="psyneulink.core.compositions.composition.Composition.learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">learning_rate</span></code></a> specified for the System to which the
389c389
< <a class="reference internal" href="LearningFunctions.html#psyneulink.core.components.functions.learningfunctions.LearningFunction.default_learning_rate" title="psyneulink.core.components.functions.learningfunctions.LearningFunction.default_learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">default_learning_rate</span></code></a> for the <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function" title="psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> is used (see <a class="reference internal" href="LearningMechanism.html#learningmechanism-learning-rate"><span class="std std-ref">learning_rate</span></a>
---
> <code class="xref any docutils literal notranslate"><span class="pre">default_learning_rate</span></code> for the <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function" title="psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> is used (see <a class="reference internal" href="LearningMechanism.html#learningmechanism-learning-rate"><span class="std std-ref">learning_rate</span></a>
diff -r docs-base/AutodiffComposition.html docs-head/AutodiffComposition.html
217c217
< <div><ul class="simple">
---
> <div><ul>
219,225c219,235
< <li><p><a class="reference internal" href="#autodiffcomposition-creation"><span class="std std-ref">Creating an AutodiffComposition</span></a></p></li>
< <li><dl class="simple">
< <dt><a class="reference internal" href="#autodiffcomposition-execution"><span class="std std-ref">Execution</span></a></dt><dd><ul>
< <li><p><a class="reference internal" href="#autodiffcomposition-llvm"><span class="std std-ref">LLVM mode</span></a></p></li>
< <li><p><a class="reference internal" href="#autodiffcomposition-pytorch"><span class="std std-ref">PyTorch mode</span></a></p></li>
< <li><p><a class="reference internal" href="#autodiffcomposition-nested-modulation"><span class="std std-ref">Nested Execution and Modulation</span></a></p></li>
< <li><p><a class="reference internal" href="#autodiffcomposition-logging"><span class="std std-ref">Logging</span></a></p></li>
---
> <li><p><a class="reference internal" href="#autodiffcomposition-creation"><span class="std std-ref">Creating an AutodiffComposition</span></a>
> - <code class="xref any docutils literal notranslate"><span class="pre">AutodiffComposition_</span></code></p>
> <blockquote>
> <div><ul class="simple">
> <li><p><a class="reference internal" href="#autodiffcomposition-modulatory-mechanisms"><span class="std std-ref">Only one OutputPort per Node</span></a></p></li>
> <li><p><a class="reference internal" href="#autodiffcomposition-bias-parameters"><span class="std std-ref">No Bias Parameters</span></a></p></li>
> <li><p><a class="reference internal" href="#autodiffcomposition-nesting"><span class="std std-ref">Nesting</span></a></p></li>
> <li><p><a class="reference internal" href="#autodiffcomposition-post-construction-modification"><span class="std std-ref">No Post-construction Modification</span></a></p></li>
> </ul>
> </div></blockquote>
> <ul class="simple">
> <li><p><a class="reference internal" href="#autodiffcomposition-execution"><span class="std std-ref">Execution</span></a>
> - <a class="reference internal" href="#autodiffcomposition-pytorch"><span class="std std-ref">PyTorch mode</span></a>
> - <a class="reference internal" href="#autodiffcomposition-llvm"><span class="std std-ref">LLVM mode</span></a>
> - <a class="reference internal" href="#autodiffcomposition-python"><span class="std std-ref">Python mode</span></a>
> - <a class="reference internal" href="#autodiffcomposition-nested-modulation"><span class="std std-ref">Nested Execution and Modulation</span></a>
> - <a class="reference internal" href="#autodiffcomposition-logging"><span class="std std-ref">Logging</span></a></p></li>
227,228d236
< </dd>
< </dl>
251c259
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_projections" title="psyneulink.core.compositions.composition.Composition.add_projections"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_projection</span></code></a>,  <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway" title="psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_linear_processing_pathway</span></code></a>, etc.).  The constructor also includes a number of parameters that are
---
> <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_projections" title="psyneulink.core.compositions.composition.Composition.add_projections"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_projection</span></code></a>,  <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway" title="psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_linear_processing_pathway</span></code></a>, etc.). The constructor also includes a number of parameters that are
253,264c261,278
< and <a class="reference internal" href="#autodiffcomposition-examples"><span class="std std-ref">examples</span></a> below).  Note that all of the Components in an AutodiffComposition
< must be able to be subject to <a class="reference internal" href="Composition.html#composition-learning"><span class="std std-ref">learning</span></a>, but cannot include any <a class="reference internal" href="Composition.html#composition-learning-components"><span class="std std-ref">learning components</span></a> themselves.  Specifically, it cannot include any <a class="reference internal" href="ModulatoryMechanism.html"><span class="doc">ModulatoryMechanisms</span></a>, <a class="reference internal" href="LearningProjection.html"><span class="doc">LearningProjections</span></a>, or the ObjectiveMechanism &lt;OBJECTIVE_MECHANISM&gt;`
< used to compute the loss for learning.</p>
< <blockquote>
< <div><div class="admonition warning" id="autodiff-learning-components-warning">
< <p class="admonition-title">Warning</p>
< <p>When an AutodiffComposition is constructed, it creates all of the learning Components
< that are needed, and thus <strong>cannot include</strong> any that are prespecified.</p>
< </div>
< </div></blockquote>
< <p>This means that an AutodiffComposition also cannot itself include a <a class="reference internal" href="Composition.html#composition-controller"><span class="std std-ref">controller</span></a> or any
< <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanisms</span></a>.  However, it can include Mechanisms that are subject to modulatory control
---
> and <a class="reference internal" href="#autodiffcomposition-examples"><span class="std std-ref">examples</span></a> below). While an AutodiffComposition can generally be created using the
> same methods as a standard Composition, there are a few restrictions that apply to its construction, summarized below.</p>
> <section id="only-one-outputport-per-node">
> <span id="autodiffcomposition-modulatory-mechanisms"></span><span id="autodiffcomposition-restrictions"></span><h3><em>Only one OutputPort per Node</em><a class="headerlink" href="#only-one-outputport-per-node" title="Permalink to this headline">¶</a></h3>
> <p>The <a class="reference internal" href="Composition.html#composition-nodes"><span class="std std-ref">Nodes</span></a> of an AutodiffComposition currently can have only <em>one</em> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a>, though that
> can have more than one <a class="reference internal" href="Port.html#psyneulink.core.components.ports.port.Port_Base.efferents" title="psyneulink.core.components.ports.port.Port_Base.efferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">efferent</span></code></a> <a class="reference internal" href="MappingProjection.html"><span class="doc">MappingProjection</span></a>.  Nodes can also have more than one
> <a class="reference internal" href="InputPort.html"><span class="doc">InputPort</span></a>, that can receive more than one <a class="reference internal" href="Port.html#psyneulink.core.components.ports.port.Port_Base.path_afferents" title="psyneulink.core.components.ports.port.Port_Base.path_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">afferent</span> <span class="pre">`path_afferent</span></code></a> Projections.</p>
> </section>
> <section id="no-modulatory-components">
> <h3><em>No Modulatory Components</em><a class="headerlink" href="#no-modulatory-components" title="Permalink to this headline">¶</a></h3>
> <p>All of the Components in an AutodiffComposition must be able to be subjected to <a class="reference internal" href="Composition.html#composition-learning"><span class="std std-ref">learning</span></a>,
> which means that no <a class="reference internal" href="ModulatoryMechanism.html"><span class="doc">ModulatoryMechanisms</span></a> can be included in an AutodiffComposition.
> Specifically, this precludes any <a class="reference internal" href="Composition.html#composition-learning-components"><span class="std std-ref">learning components</span></a>, <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanisms</span></a>, or a <a class="reference internal" href="Composition.html#composition-controller"><span class="std std-ref">controller</span></a>.</p>
> <p id="autodiff-learning-components-warning"><em>Learning Components.</em>  An AutodiffComposition <strong>cannot include any</strong> <a class="reference internal" href="Composition.html#composition-learning-components"><span class="std std-ref">learning components</span></a> themselves (i.e., <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanisms</span></a>, <a class="reference internal" href="LearningSignal.html"><span class="doc">LearningSignals</span></a>, or LearningProjections &lt;LearningProjection&gt;`, nor the <code class="xref any docutils literal notranslate"><span class="pre">ComparatorMechanism</span></code>
> or <a class="reference internal" href="Composition.html#objective-mechanism"><span class="std std-ref">ObjectiveMechanism</span></a> used to compute the loss for learning). These are constructed
> automatically when learning is executed in <a class="reference internal" href="#autodiffcomposition-python"><span class="std std-ref">Python mode</span></a> or <a class="reference internal" href="#autodiffcomposition-llvm"><span class="std std-ref">LLVM mode</span></a>, and PyTorch-compatible Components are constructed when it is executed in <a class="reference internal" href="#autodiffcomposition-pytorch"><span class="std std-ref">PyTorch mode</span></a>.</p>
> <p><em>Control Components.</em>  An AutodiffComposition also cannot include any <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanisms</span></a> or a
> <a class="reference internal" href="Composition.html#composition-controller"><span class="std std-ref">controller</span></a>.  However, it <em>can</em> include Mechanisms that are subject to modulatory control
269,272c283,285
< <p>A few other restrictions apply to the construction and modification of AutodiffCompositions:</p>
< <blockquote>
< <div><div class="admonition hint">
< <p class="admonition-title">Hint</p>
---
> </section>
> <section id="no-bias-parameters">
> <span id="autodiffcomposition-bias-parameters"></span><h3><em>No Bias Parameters</em><a class="headerlink" href="#no-bias-parameters" title="Permalink to this headline">¶</a></h3>
274,276c287,288
< Thus, when comparing a model constructed using an AutodiffComposition to a corresponding model in PyTorch, the
< <code class="xref any docutils literal notranslate"><span class="pre">bias</span></code> parameter of PyTorch modules should be set
< to <code class="xref any docutils literal notranslate"><span class="pre">False</span></code>.  Trainable biases <em>can</em> be specified explicitly in an AutodiffComposition by including a
---
> Thus, when constructing a model using an AutodiffComposition that corresponds to one in PyTorch, the <code class="xref any docutils literal notranslate"><span class="pre">bias</span></code> parameter of PyTorch modules should be set
> to <code class="xref any docutils literal notranslate"><span class="pre">False</span></code>. Trainable biases <em>can</em> be specified explicitly in an AutodiffComposition by including a
279a292,304
> </section>
> <section id="nesting">
> <span id="autodiffcomposition-nesting"></span><h3><em>Nesting</em><a class="headerlink" href="#nesting" title="Permalink to this headline">¶</a></h3>
> <p>An AutodiffComposition can be <a class="reference internal" href="Composition.html#composition-nested"><span class="std std-ref">nested</span></a> inside another Composition for learning, and there can
> be any level of such nestings.  However, all of the nested Compositions must be AutodiffCompositions. Furthermore, all
> nested Compositions use the <a class="reference internal" href="#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">learning_rate</span></code></a> specified for the outermost Composition,
> whether this is specified in the call to its <a class="reference internal" href="#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learn" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method, its constructor, or its
> default value is being used (see <a class="reference internal" href="#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">learning_rate</span></code></a> below for additional details).</p>
> <div class="technical-note docutils container">
> <p>Projections from <a class="reference internal" href="Composition.html#composition-nodes"><span class="std std-ref">Nodes</span></a> in an immediately enclosing outer Composition to the <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.input
...

See CI logs for the full diff.

kmantel and others added 6 commits December 14, 2023 01:55
- dependency dict must store names, not classes
- must exclude own class name from dependencies (but not "alias" class
names like And->All or Or->Any
supports graph structure conditions automatically
function that produces a python sorting key given a dependency
dictionary
- modify Scheduler wrappers to support both basic and structural
Conditions
- add wrappers for new graph_scheduler.Scheduler methods:
	- remove_condition
	- add_graph_edge
	- remove_graph_edge
- update requirements to graph-scheduler<1.3.0 to include graph
structure conditions release
Support graph-scheduler graph structure conditions
Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11-x64):

diff -r docs-base/AutoAssociativeLearningMechanism.html docs-head/AutoAssociativeLearningMechanism.html
387c387
< If it is <code class="xref any docutils literal notranslate"><span class="pre">None</span></code>, then the <code class="xref any docutils literal notranslate"><span class="pre">learning_rate</span></code> specified for the System to which the
---
> If it is <code class="xref any docutils literal notranslate"><span class="pre">None</span></code>, then the <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learning_rate" title="psyneulink.core.compositions.composition.Composition.learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">learning_rate</span></code></a> specified for the System to which the
389c389
< <a class="reference internal" href="LearningFunctions.html#psyneulink.core.components.functions.learningfunctions.LearningFunction.default_learning_rate" title="psyneulink.core.components.functions.learningfunctions.LearningFunction.default_learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">default_learning_rate</span></code></a> for the <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function" title="psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> is used (see <a class="reference internal" href="LearningMechanism.html#learningmechanism-learning-rate"><span class="std std-ref">learning_rate</span></a>
---
> <code class="xref any docutils literal notranslate"><span class="pre">default_learning_rate</span></code> for the <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function" title="psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> is used (see <a class="reference internal" href="LearningMechanism.html#learningmechanism-learning-rate"><span class="std std-ref">learning_rate</span></a>
diff -r docs-base/AutodiffComposition.html docs-head/AutodiffComposition.html
217c217
< <div><ul class="simple">
---
> <div><ul>
219,225c219,235
< <li><p><a class="reference internal" href="#autodiffcomposition-creation"><span class="std std-ref">Creating an AutodiffComposition</span></a></p></li>
< <li><dl class="simple">
< <dt><a class="reference internal" href="#autodiffcomposition-execution"><span class="std std-ref">Execution</span></a></dt><dd><ul>
< <li><p><a class="reference internal" href="#autodiffcomposition-llvm"><span class="std std-ref">LLVM mode</span></a></p></li>
< <li><p><a class="reference internal" href="#autodiffcomposition-pytorch"><span class="std std-ref">PyTorch mode</span></a></p></li>
< <li><p><a class="reference internal" href="#autodiffcomposition-nested-modulation"><span class="std std-ref">Nested Execution and Modulation</span></a></p></li>
< <li><p><a class="reference internal" href="#autodiffcomposition-logging"><span class="std std-ref">Logging</span></a></p></li>
---
> <li><p><a class="reference internal" href="#autodiffcomposition-creation"><span class="std std-ref">Creating an AutodiffComposition</span></a>
> - <code class="xref any docutils literal notranslate"><span class="pre">AutodiffComposition_</span></code></p>
> <blockquote>
> <div><ul class="simple">
> <li><p><a class="reference internal" href="#autodiffcomposition-modulatory-mechanisms"><span class="std std-ref">Only one OutputPort per Node</span></a></p></li>
> <li><p><a class="reference internal" href="#autodiffcomposition-bias-parameters"><span class="std std-ref">No Bias Parameters</span></a></p></li>
> <li><p><a class="reference internal" href="#autodiffcomposition-nesting"><span class="std std-ref">Nesting</span></a></p></li>
> <li><p><a class="reference internal" href="#autodiffcomposition-post-construction-modification"><span class="std std-ref">No Post-construction Modification</span></a></p></li>
> </ul>
> </div></blockquote>
> <ul class="simple">
> <li><p><a class="reference internal" href="#autodiffcomposition-execution"><span class="std std-ref">Execution</span></a>
> - <a class="reference internal" href="#autodiffcomposition-pytorch"><span class="std std-ref">PyTorch mode</span></a>
> - <a class="reference internal" href="#autodiffcomposition-llvm"><span class="std std-ref">LLVM mode</span></a>
> - <a class="reference internal" href="#autodiffcomposition-python"><span class="std std-ref">Python mode</span></a>
> - <a class="reference internal" href="#autodiffcomposition-nested-modulation"><span class="std std-ref">Nested Execution and Modulation</span></a>
> - <a class="reference internal" href="#autodiffcomposition-logging"><span class="std std-ref">Logging</span></a></p></li>
227,228d236
< </dd>
< </dl>
251c259
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_projections" title="psyneulink.core.compositions.composition.Composition.add_projections"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_projection</span></code></a>,  <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway" title="psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_linear_processing_pathway</span></code></a>, etc.).  The constructor also includes a number of parameters that are
---
> <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_projections" title="psyneulink.core.compositions.composition.Composition.add_projections"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_projection</span></code></a>,  <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway" title="psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_linear_processing_pathway</span></code></a>, etc.). The constructor also includes a number of parameters that are
253,264c261,278
< and <a class="reference internal" href="#autodiffcomposition-examples"><span class="std std-ref">examples</span></a> below).  Note that all of the Components in an AutodiffComposition
< must be able to be subject to <a class="reference internal" href="Composition.html#composition-learning"><span class="std std-ref">learning</span></a>, but cannot include any <a class="reference internal" href="Composition.html#composition-learning-components"><span class="std std-ref">learning components</span></a> themselves.  Specifically, it cannot include any <a class="reference internal" href="ModulatoryMechanism.html"><span class="doc">ModulatoryMechanisms</span></a>, <a class="reference internal" href="LearningProjection.html"><span class="doc">LearningProjections</span></a>, or the ObjectiveMechanism &lt;OBJECTIVE_MECHANISM&gt;`
< used to compute the loss for learning.</p>
< <blockquote>
< <div><div class="admonition warning" id="autodiff-learning-components-warning">
< <p class="admonition-title">Warning</p>
< <p>When an AutodiffComposition is constructed, it creates all of the learning Components
< that are needed, and thus <strong>cannot include</strong> any that are prespecified.</p>
< </div>
< </div></blockquote>
< <p>This means that an AutodiffComposition also cannot itself include a <a class="reference internal" href="Composition.html#composition-controller"><span class="std std-ref">controller</span></a> or any
< <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanisms</span></a>.  However, it can include Mechanisms that are subject to modulatory control
---
> and <a class="reference internal" href="#autodiffcomposition-examples"><span class="std std-ref">examples</span></a> below). While an AutodiffComposition can generally be created using the
> same methods as a standard Composition, there are a few restrictions that apply to its construction, summarized below.</p>
> <section id="only-one-outputport-per-node">
> <span id="autodiffcomposition-modulatory-mechanisms"></span><span id="autodiffcomposition-restrictions"></span><h3><em>Only one OutputPort per Node</em><a class="headerlink" href="#only-one-outputport-per-node" title="Permalink to this headline">¶</a></h3>
> <p>The <a class="reference internal" href="Composition.html#composition-nodes"><span class="std std-ref">Nodes</span></a> of an AutodiffComposition currently can have only <em>one</em> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a>, though that
> can have more than one <a class="reference internal" href="Port.html#psyneulink.core.components.ports.port.Port_Base.efferents" title="psyneulink.core.components.ports.port.Port_Base.efferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">efferent</span></code></a> <a class="reference internal" href="MappingProjection.html"><span class="doc">MappingProjection</span></a>.  Nodes can also have more than one
> <a class="reference internal" href="InputPort.html"><span class="doc">InputPort</span></a>, that can receive more than one <a class="reference internal" href="Port.html#psyneulink.core.components.ports.port.Port_Base.path_afferents" title="psyneulink.core.components.ports.port.Port_Base.path_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">afferent</span> <span class="pre">`path_afferent</span></code></a> Projections.</p>
> </section>
> <section id="no-modulatory-components">
> <h3><em>No Modulatory Components</em><a class="headerlink" href="#no-modulatory-components" title="Permalink to this headline">¶</a></h3>
> <p>All of the Components in an AutodiffComposition must be able to be subjected to <a class="reference internal" href="Composition.html#composition-learning"><span class="std std-ref">learning</span></a>,
> which means that no <a class="reference internal" href="ModulatoryMechanism.html"><span class="doc">ModulatoryMechanisms</span></a> can be included in an AutodiffComposition.
> Specifically, this precludes any <a class="reference internal" href="Composition.html#composition-learning-components"><span class="std std-ref">learning components</span></a>, <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanisms</span></a>, or a <a class="reference internal" href="Composition.html#composition-controller"><span class="std std-ref">controller</span></a>.</p>
> <p id="autodiff-learning-components-warning"><em>Learning Components.</em>  An AutodiffComposition <strong>cannot include any</strong> <a class="reference internal" href="Composition.html#composition-learning-components"><span class="std std-ref">learning components</span></a> themselves (i.e., <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanisms</span></a>, <a class="reference internal" href="LearningSignal.html"><span class="doc">LearningSignals</span></a>, or LearningProjections &lt;LearningProjection&gt;`, nor the <code class="xref any docutils literal notranslate"><span class="pre">ComparatorMechanism</span></code>
> or <a class="reference internal" href="Composition.html#objective-mechanism"><span class="std std-ref">ObjectiveMechanism</span></a> used to compute the loss for learning). These are constructed
> automatically when learning is executed in <a class="reference internal" href="#autodiffcomposition-python"><span class="std std-ref">Python mode</span></a> or <a class="reference internal" href="#autodiffcomposition-llvm"><span class="std std-ref">LLVM mode</span></a>, and PyTorch-compatible Components are constructed when it is executed in <a class="reference internal" href="#autodiffcomposition-pytorch"><span class="std std-ref">PyTorch mode</span></a>.</p>
> <p><em>Control Components.</em>  An AutodiffComposition also cannot include any <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanisms</span></a> or a
> <a class="reference internal" href="Composition.html#composition-controller"><span class="std std-ref">controller</span></a>.  However, it <em>can</em> include Mechanisms that are subject to modulatory control
269,272c283,285
< <p>A few other restrictions apply to the construction and modification of AutodiffCompositions:</p>
< <blockquote>
< <div><div class="admonition hint">
< <p class="admonition-title">Hint</p>
---
> </section>
> <section id="no-bias-parameters">
> <span id="autodiffcomposition-bias-parameters"></span><h3><em>No Bias Parameters</em><a class="headerlink" href="#no-bias-parameters" title="Permalink to this headline">¶</a></h3>
274,276c287,288
< Thus, when comparing a model constructed using an AutodiffComposition to a corresponding model in PyTorch, the
< <code class="xref any docutils literal notranslate"><span class="pre">bias</span></code> parameter of PyTorch modules should be set
< to <code class="xref any docutils literal notranslate"><span class="pre">False</span></code>.  Trainable biases <em>can</em> be specified explicitly in an AutodiffComposition by including a
---
> Thus, when constructing a model using an AutodiffComposition that corresponds to one in PyTorch, the <code class="xref any docutils literal notranslate"><span class="pre">bias</span></code> parameter of PyTorch modules should be set
> to <code class="xref any docutils literal notranslate"><span class="pre">False</span></code>. Trainable biases <em>can</em> be specified explicitly in an AutodiffComposition by including a
279a292,304
> </section>
> <section id="nesting">
> <span id="autodiffcomposition-nesting"></span><h3><em>Nesting</em><a class="headerlink" href="#nesting" title="Permalink to this headline">¶</a></h3>
> <p>An AutodiffComposition can be <a class="reference internal" href="Composition.html#composition-nested"><span class="std std-ref">nested</span></a> inside another Composition for learning, and there can
> be any level of such nestings.  However, all of the nested Compositions must be AutodiffCompositions. Furthermore, all
> nested Compositions use the <a class="reference internal" href="#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">learning_rate</span></code></a> specified for the outermost Composition,
> whether this is specified in the call to its <a class="reference internal" href="#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learn" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method, its constructor, or its
> default value is being used (see <a class="reference internal" href="#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">learning_rate</span></code></a> below for additional details).</p>
> <div class="technical-note docutils container">
> <p>Projections from <a class="reference internal" href="Composition.html#composition-nodes"><span class="std std-ref">Nodes</span></a> in an immediately enclosing outer Composition to the <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.input
...

See CI logs for the full diff.

Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.11-x64):

diff -r docs-base/AutoAssociativeLearningMechanism.html docs-head/AutoAssociativeLearningMechanism.html
387c387
< If it is <code class="xref any docutils literal notranslate"><span class="pre">None</span></code>, then the <code class="xref any docutils literal notranslate"><span class="pre">learning_rate</span></code> specified for the System to which the
---
> If it is <code class="xref any docutils literal notranslate"><span class="pre">None</span></code>, then the <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.learning_rate" title="psyneulink.core.compositions.composition.Composition.learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">learning_rate</span></code></a> specified for the System to which the
389c389
< <a class="reference internal" href="LearningFunctions.html#psyneulink.core.components.functions.learningfunctions.LearningFunction.default_learning_rate" title="psyneulink.core.components.functions.learningfunctions.LearningFunction.default_learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">default_learning_rate</span></code></a> for the <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function" title="psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> is used (see <a class="reference internal" href="LearningMechanism.html#learningmechanism-learning-rate"><span class="std std-ref">learning_rate</span></a>
---
> <code class="xref any docutils literal notranslate"><span class="pre">default_learning_rate</span></code> for the <a class="reference internal" href="#psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function" title="psyneulink.library.components.mechanisms.modulatory.learning.autoassociativelearningmechanism.AutoAssociativeLearningMechanism.function"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">function</span></code></a> is used (see <a class="reference internal" href="LearningMechanism.html#learningmechanism-learning-rate"><span class="std std-ref">learning_rate</span></a>
diff -r docs-base/AutodiffComposition.html docs-head/AutodiffComposition.html
217c217
< <div><ul class="simple">
---
> <div><ul>
219,225c219,235
< <li><p><a class="reference internal" href="#autodiffcomposition-creation"><span class="std std-ref">Creating an AutodiffComposition</span></a></p></li>
< <li><dl class="simple">
< <dt><a class="reference internal" href="#autodiffcomposition-execution"><span class="std std-ref">Execution</span></a></dt><dd><ul>
< <li><p><a class="reference internal" href="#autodiffcomposition-llvm"><span class="std std-ref">LLVM mode</span></a></p></li>
< <li><p><a class="reference internal" href="#autodiffcomposition-pytorch"><span class="std std-ref">PyTorch mode</span></a></p></li>
< <li><p><a class="reference internal" href="#autodiffcomposition-nested-modulation"><span class="std std-ref">Nested Execution and Modulation</span></a></p></li>
< <li><p><a class="reference internal" href="#autodiffcomposition-logging"><span class="std std-ref">Logging</span></a></p></li>
---
> <li><p><a class="reference internal" href="#autodiffcomposition-creation"><span class="std std-ref">Creating an AutodiffComposition</span></a>
> - <code class="xref any docutils literal notranslate"><span class="pre">AutodiffComposition_</span></code></p>
> <blockquote>
> <div><ul class="simple">
> <li><p><a class="reference internal" href="#autodiffcomposition-modulatory-mechanisms"><span class="std std-ref">Only one OutputPort per Node</span></a></p></li>
> <li><p><a class="reference internal" href="#autodiffcomposition-bias-parameters"><span class="std std-ref">No Bias Parameters</span></a></p></li>
> <li><p><a class="reference internal" href="#autodiffcomposition-nesting"><span class="std std-ref">Nesting</span></a></p></li>
> <li><p><a class="reference internal" href="#autodiffcomposition-post-construction-modification"><span class="std std-ref">No Post-construction Modification</span></a></p></li>
> </ul>
> </div></blockquote>
> <ul class="simple">
> <li><p><a class="reference internal" href="#autodiffcomposition-execution"><span class="std std-ref">Execution</span></a>
> - <a class="reference internal" href="#autodiffcomposition-pytorch"><span class="std std-ref">PyTorch mode</span></a>
> - <a class="reference internal" href="#autodiffcomposition-llvm"><span class="std std-ref">LLVM mode</span></a>
> - <a class="reference internal" href="#autodiffcomposition-python"><span class="std std-ref">Python mode</span></a>
> - <a class="reference internal" href="#autodiffcomposition-nested-modulation"><span class="std std-ref">Nested Execution and Modulation</span></a>
> - <a class="reference internal" href="#autodiffcomposition-logging"><span class="std std-ref">Logging</span></a></p></li>
227,228d236
< </dd>
< </dl>
251c259
< <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_projections" title="psyneulink.core.compositions.composition.Composition.add_projections"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_projection</span></code></a>,  <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway" title="psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_linear_processing_pathway</span></code></a>, etc.).  The constructor also includes a number of parameters that are
---
> <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_projections" title="psyneulink.core.compositions.composition.Composition.add_projections"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_projection</span></code></a>,  <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway" title="psyneulink.core.compositions.composition.Composition.add_linear_processing_pathway"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">add_linear_processing_pathway</span></code></a>, etc.). The constructor also includes a number of parameters that are
253,264c261,278
< and <a class="reference internal" href="#autodiffcomposition-examples"><span class="std std-ref">examples</span></a> below).  Note that all of the Components in an AutodiffComposition
< must be able to be subject to <a class="reference internal" href="Composition.html#composition-learning"><span class="std std-ref">learning</span></a>, but cannot include any <a class="reference internal" href="Composition.html#composition-learning-components"><span class="std std-ref">learning components</span></a> themselves.  Specifically, it cannot include any <a class="reference internal" href="ModulatoryMechanism.html"><span class="doc">ModulatoryMechanisms</span></a>, <a class="reference internal" href="LearningProjection.html"><span class="doc">LearningProjections</span></a>, or the ObjectiveMechanism &lt;OBJECTIVE_MECHANISM&gt;`
< used to compute the loss for learning.</p>
< <blockquote>
< <div><div class="admonition warning" id="autodiff-learning-components-warning">
< <p class="admonition-title">Warning</p>
< <p>When an AutodiffComposition is constructed, it creates all of the learning Components
< that are needed, and thus <strong>cannot include</strong> any that are prespecified.</p>
< </div>
< </div></blockquote>
< <p>This means that an AutodiffComposition also cannot itself include a <a class="reference internal" href="Composition.html#composition-controller"><span class="std std-ref">controller</span></a> or any
< <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanisms</span></a>.  However, it can include Mechanisms that are subject to modulatory control
---
> and <a class="reference internal" href="#autodiffcomposition-examples"><span class="std std-ref">examples</span></a> below). While an AutodiffComposition can generally be created using the
> same methods as a standard Composition, there are a few restrictions that apply to its construction, summarized below.</p>
> <section id="only-one-outputport-per-node">
> <span id="autodiffcomposition-modulatory-mechanisms"></span><span id="autodiffcomposition-restrictions"></span><h3><em>Only one OutputPort per Node</em><a class="headerlink" href="#only-one-outputport-per-node" title="Permalink to this headline">¶</a></h3>
> <p>The <a class="reference internal" href="Composition.html#composition-nodes"><span class="std std-ref">Nodes</span></a> of an AutodiffComposition currently can have only <em>one</em> <a class="reference internal" href="OutputPort.html"><span class="doc">OutputPort</span></a>, though that
> can have more than one <a class="reference internal" href="Port.html#psyneulink.core.components.ports.port.Port_Base.efferents" title="psyneulink.core.components.ports.port.Port_Base.efferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">efferent</span></code></a> <a class="reference internal" href="MappingProjection.html"><span class="doc">MappingProjection</span></a>.  Nodes can also have more than one
> <a class="reference internal" href="InputPort.html"><span class="doc">InputPort</span></a>, that can receive more than one <a class="reference internal" href="Port.html#psyneulink.core.components.ports.port.Port_Base.path_afferents" title="psyneulink.core.components.ports.port.Port_Base.path_afferents"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">afferent</span> <span class="pre">`path_afferent</span></code></a> Projections.</p>
> </section>
> <section id="no-modulatory-components">
> <h3><em>No Modulatory Components</em><a class="headerlink" href="#no-modulatory-components" title="Permalink to this headline">¶</a></h3>
> <p>All of the Components in an AutodiffComposition must be able to be subjected to <a class="reference internal" href="Composition.html#composition-learning"><span class="std std-ref">learning</span></a>,
> which means that no <a class="reference internal" href="ModulatoryMechanism.html"><span class="doc">ModulatoryMechanisms</span></a> can be included in an AutodiffComposition.
> Specifically, this precludes any <a class="reference internal" href="Composition.html#composition-learning-components"><span class="std std-ref">learning components</span></a>, <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanisms</span></a>, or a <a class="reference internal" href="Composition.html#composition-controller"><span class="std std-ref">controller</span></a>.</p>
> <p id="autodiff-learning-components-warning"><em>Learning Components.</em>  An AutodiffComposition <strong>cannot include any</strong> <a class="reference internal" href="Composition.html#composition-learning-components"><span class="std std-ref">learning components</span></a> themselves (i.e., <a class="reference internal" href="LearningMechanism.html"><span class="doc">LearningMechanisms</span></a>, <a class="reference internal" href="LearningSignal.html"><span class="doc">LearningSignals</span></a>, or LearningProjections &lt;LearningProjection&gt;`, nor the <code class="xref any docutils literal notranslate"><span class="pre">ComparatorMechanism</span></code>
> or <a class="reference internal" href="Composition.html#objective-mechanism"><span class="std std-ref">ObjectiveMechanism</span></a> used to compute the loss for learning). These are constructed
> automatically when learning is executed in <a class="reference internal" href="#autodiffcomposition-python"><span class="std std-ref">Python mode</span></a> or <a class="reference internal" href="#autodiffcomposition-llvm"><span class="std std-ref">LLVM mode</span></a>, and PyTorch-compatible Components are constructed when it is executed in <a class="reference internal" href="#autodiffcomposition-pytorch"><span class="std std-ref">PyTorch mode</span></a>.</p>
> <p><em>Control Components.</em>  An AutodiffComposition also cannot include any <a class="reference internal" href="ControlMechanism.html"><span class="doc">ControlMechanisms</span></a> or a
> <a class="reference internal" href="Composition.html#composition-controller"><span class="std std-ref">controller</span></a>.  However, it <em>can</em> include Mechanisms that are subject to modulatory control
269,272c283,285
< <p>A few other restrictions apply to the construction and modification of AutodiffCompositions:</p>
< <blockquote>
< <div><div class="admonition hint">
< <p class="admonition-title">Hint</p>
---
> </section>
> <section id="no-bias-parameters">
> <span id="autodiffcomposition-bias-parameters"></span><h3><em>No Bias Parameters</em><a class="headerlink" href="#no-bias-parameters" title="Permalink to this headline">¶</a></h3>
274,276c287,288
< Thus, when comparing a model constructed using an AutodiffComposition to a corresponding model in PyTorch, the
< <code class="xref any docutils literal notranslate"><span class="pre">bias</span></code> parameter of PyTorch modules should be set
< to <code class="xref any docutils literal notranslate"><span class="pre">False</span></code>.  Trainable biases <em>can</em> be specified explicitly in an AutodiffComposition by including a
---
> Thus, when constructing a model using an AutodiffComposition that corresponds to one in PyTorch, the <code class="xref any docutils literal notranslate"><span class="pre">bias</span></code> parameter of PyTorch modules should be set
> to <code class="xref any docutils literal notranslate"><span class="pre">False</span></code>. Trainable biases <em>can</em> be specified explicitly in an AutodiffComposition by including a
279a292,304
> </section>
> <section id="nesting">
> <span id="autodiffcomposition-nesting"></span><h3><em>Nesting</em><a class="headerlink" href="#nesting" title="Permalink to this headline">¶</a></h3>
> <p>An AutodiffComposition can be <a class="reference internal" href="Composition.html#composition-nested"><span class="std std-ref">nested</span></a> inside another Composition for learning, and there can
> be any level of such nestings.  However, all of the nested Compositions must be AutodiffCompositions. Furthermore, all
> nested Compositions use the <a class="reference internal" href="#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">learning_rate</span></code></a> specified for the outermost Composition,
> whether this is specified in the call to its <a class="reference internal" href="#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learn" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learn"><code class="xref any py py-meth docutils literal notranslate"><span class="pre">learn</span></code></a> method, its constructor, or its
> default value is being used (see <a class="reference internal" href="#psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate" title="psyneulink.library.compositions.autodiffcomposition.AutodiffComposition.learning_rate"><code class="xref any py py-attr docutils literal notranslate"><span class="pre">learning_rate</span></code></a> below for additional details).</p>
> <div class="technical-note docutils container">
> <p>Projections from <a class="reference internal" href="Composition.html#composition-nodes"><span class="std std-ref">Nodes</span></a> in an immediately enclosing outer Composition to the <a class="reference internal" href="Composition.html#psyneulink.core.compositions.composition.Composition.input
...

See CI logs for the full diff.

@kmantel kmantel merged commit f062be4 into master Dec 15, 2023
61 of 62 checks passed
kmantel added a commit to kmantel/PsyNeuLink that referenced this pull request Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants