Conversation
…init status (#3456) some methods like _update_default_variable are called elsewhere after initialization of the actual object, and this can cause state side-effects. avoids incrementing some integrators, as in the duration_cost_fct for OptimizationControlMechanism in test_modulation_simple or test_control.py::TestControlSpecification::test_deferred_init test results are modified; adding extra executions in the None context prior to running the compositions reproduces the previous results: test_deferred_init: `comp.controller.state_input_ports[0].function.execute([1.1]` `comp.controller.state_input_ports[1].function.execute([2.2]` test_modulation_simple: `comp.controller.control_signals[0].function.duration_cost_fct.execute([3]` see #2721
intended to allow non-Component objects also maintain Parameters objects
used to retrieve projection objects by name
intended to allow throwing a consistent error in multiple places other than just Parameter._validate
When a Parameter is tracking compiled struct storage, its current value may be an ndarray view into LLVM param memory. Setting that param from a Python scalar can fail the intended in-place update path and leave compiled memory stale. Coerce scalar sources to np.asarray(...) only when: - _tracking_compiled_struct is True, and - target_value is an ndarray. This preserves in-place mutation via update_array_in_place without changing Python-only scalar behavior. Fixes compiled-mode control-param updates (notably execute_until_finished), which affected LCA step/time reporting in tests/mechanisms/test_lca.py::TestLCA::test_LCAMechanism_standard_output_ports.
…Link into feat/lca/standard_output_ports_DEVEL_pec_fix
- In RecurrentTransferMechanism LLVM reset, stop zeroing `old_val`. - After integrator reset, run the primary transfer function and update output ports from that result, so recurrent feedback state is seeded from reset outputs. - This removes the LLVM/Python step-count divergence in `test_LCAMechanism_standard_output_ports` (LLVM now matches 56/.056). tests: simplify LCA standard_output_ports mode handling - Replace `return True` with `pytest.skip(...)` for unsupported execution modes. - Collapse redundant `comp_mode` conditionals and duplicate expected-value branches. - Update LLVM expected tuple to `(1, 56, .056)` to match aligned behavior. chore: clean comment wrapping/whitespace in Parameter in-place update block
- single location/standardization of parsing and validation that does not modify existing parameter values - partial integration with Parameter classes (TBI: refactoring as a sublcass of Parameter) - projections: implement ProxyProjection - formal class for the 'virtual' projections that span a Composition and a nested Composition that each represent two projections: one from a node in one Composition to a CIM and one from that CIM to another node in the other Composition. - Simplifies storage of learning_rate/optimization parameters using SharedParameter functional WIP with remaining tasks: - generalize optimization parameters as subclass of Parameter, handling more than learning_rate - generalize optimization parameter dict spec to accept Mechanism/Composition, not just Projection
#3466) - single location/standardization of parsing and validation that does not modify existing parameter values - partial integration with Parameter classes (TBI: refactoring as a sublcass of Parameter) - projections: implement ProxyProjection - formal class for the 'virtual' projections that span a Composition and a nested Composition that each represent two projections: one from a node in one Composition to a CIM and one from that CIM to another node in the other Composition. - Simplifies storage of learning_rate/optimization parameters using SharedParameter functional WIP with remaining tasks: - generalize optimization parameters as subclass of Parameter, handling more than learning_rate - generalize optimization parameter dict spec to accept Mechanism/Composition, not just Projection
…ps://github.com/PrincetonUniversity/PsyNeuLink into feat/lca/standard_output_ports_DEVEL_pec_fix
Updates the requirements on [pandas](https://github.com/pandas-dev/pandas) to permit the latest version. - [Release notes](https://github.com/pandas-dev/pandas/releases) - [Commits](pandas-dev/pandas@v3.0.0...v3.0.1) --- updated-dependencies: - dependency-name: pandas dependency-version: 3.0.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v6...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 7 to 8. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v7...v8) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [protobuf](https://github.com/protocolbuffers/protobuf) to permit the latest version. - [Release notes](https://github.com/protocolbuffers/protobuf/releases) - [Commits](https://github.com/protocolbuffers/protobuf/commits) --- updated-dependencies: - dependency-name: protobuf dependency-version: 7.34.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…Link into fix/fhn-output-port-index
…y in a Mechanism (#3560) ## Summary Fixes two related bugs affecting `FitzHughNagumoIntegrator` (and multi-stateful integrators generally) when used inside a `Mechanism`. Both surfaced from the reproducer below. ### Reproducer ```python import psyneulink as pnl inp = pnl.ProcessingMechanism(input_shapes=1) lc = pnl.TransferMechanism( input_shapes=1, integrator_mode=True, integrator_function=pnl.FitzHughNagumoIntegrator(), function=pnl.Linear(), output_ports=[{pnl.VARIABLE: (pnl.OWNER_VALUE, 1)}], reset_stateful_function_when=pnl.AtTrialStart(), ) comp = pnl.Composition() comp.add_nodes([inp, lc]) comp.add_projection(sender=inp, receiver=lc) comp.run(inputs={inp: [[1.0]]}) # IndexError in Python mode; worked in LLVMRun ``` ## Bug 1 — `IndexError` on reset (`mechanism.py`) On reset, the Mechanism rebuilt its value from the integrator's reset output but kept only element `[0]`: ```python new_input = self.integrator_function.reset(...)[0] ``` `StatefulFunction.reset()` returns one entry per stateful attribute. For single-attribute integrators (`AdaptiveIntegrator` → `[previous_value]`) the `[0]` correctly unwraps. For `FitzHughNagumoIntegrator` → `[v, w, time]` it discarded `w` and `time`, leaving the value with a single element, so an `OutputPort` selecting `(OWNER_VALUE, 1)` indexed past the end → `IndexError`. Compiled mode was unaffected (statically-typed value buffer; reset only rewrites the integrator state). **Fix:** keep all stateful terms when there is more than one. ## Bug 2 — value-shape inconsistency between Python and compiled (`integratorfunctions.py`) Even after Bug 1, the mechanism's value shape differed between modes: Python produced `(3, 1, 1)`, compiled `(3, 1)` (and `defaults.value` was `(3, 1)`). FHN stacks its three stateful terms; in a Mechanism, `variable` is the Mechanism's 2d variable `(1, 1)` while the stateful values are 1d, so broadcasting during execution inflated each term to 2d → `(3, 1, 1)`. During initialization (which sizes `value`) the un-broadcast 1d state is returned → `(3, 1)`. Compiled unwraps the same leading dimension (`helpers.unwrap_2d_array`), so it stays `(3, 1)`. **Fix:** conform `variable` to the rank of the stateful values at the start of `_function` (drop the leading singleton input-port dimension), so Python matches both the advertised default and compiled execution at `(3, 1)`. Standalone use with a genuinely 2d variable (and 2d stateful values) is unaffected. This required no compiled-codegen changes. ## Testing - `test_reset_multi_stateful_integrator_with_owner_value_output_port` runs across Python and all compiled modes, asserts the value shape is `(3, 1)`, and asserts a shared value reference (tolerance covers fp32 compiled CI). - `test_FitzHughNagumo_simple_scalar` previously added a dimension to the Python expected result to work around the shape mismatch; that workaround is removed (Python now matches compiled). - `test_FitzHughNagumo_valid` and the gilzenrat figure-2 test were updated from the inflated `(3, 1, 1)` indexing to `(3, 1)` (values unchanged). - Full FHN / transfer / integrator / processing / LCA / mdf suites pass in Python and compiled. ## Notes - `OrnsteinUhlenbeckIntegrator` has a similar shape inconsistency (plus extra quirks and no existing compiled coverage). It is intentionally left out of this PR and tracked separately. - The construction-dependent FHN shape (`(3,1,1)` when the class, rather than an instance, is passed) is a separate pre-existing issue (the existing `xfail`) and is untouched here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Updates the requirements on [scipy](https://github.com/scipy/scipy) to permit the latest version. - [Release notes](https://github.com/scipy/scipy/releases) - [Commits](scipy/scipy@v1.17.0...v1.18.0) --- updated-dependencies: - dependency-name: scipy dependency-version: 1.18.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Ignore generated files. Ignore rules that do not currently pass. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Ignore line length check. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
… a line Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
No longer supported (pytest-pydocstyle repository is archived). Use Ruff D* checks instead. Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Runs monthly or on dispatch. The dispatch ref will be used. If it is left on its default value (master), it will be set to devel.
pytest-pydocstyle is archived and no longer maintained.
Fixes: 536883e ("Remove pydocstyle") Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Updates the requirements on [pytest](https://github.com/pytest-dev/pytest) to permit the latest version. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](pytest-dev/pytest@9.0.0...9.1.1) --- updated-dependencies: - dependency-name: pytest dependency-version: 9.1.1 dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [pillow](https://github.com/python-pillow/Pillow) to permit the latest version. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](python-pillow/Pillow@12.2.0...12.3.0) --- updated-dependencies: - dependency-name: pillow dependency-version: 12.3.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [llvmlite](https://github.com/numba/llvmlite) to permit the latest version. - [Release notes](https://github.com/numba/llvmlite/releases) - [Commits](numba/llvmlite@v0.47.0...v0.48.0) --- updated-dependencies: - dependency-name: llvmlite dependency-version: 0.48.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
UserDefinedFunction is allowed in the check following the crash
Updates the requirements on [grpcio](https://github.com/grpc/grpc) to permit the latest version. - [Release notes](https://github.com/grpc/grpc/releases) - [Commits](grpc/grpc@v1.81.0...v1.82.1) --- updated-dependencies: - dependency-name: grpcio dependency-version: 1.82.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…3.0,<2.14.0 (#3597) Updates the requirements on [pytorch](https://github.com/pytorch/pytorch) to permit the latest version. - [Release notes](https://github.com/pytorch/pytorch/releases/tag/v2.13.1) - [Commits](pytorch/pytorch@v2.12.0...v2.13.1) Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
| 'concatenate_queries': False, | ||
| 'enable_learning': True, | ||
| 'softmax_temperature': 0.1, | ||
| 'softmax_threshold': 1e-5, |
| IDENTITY_MATRIX, INPUT_PORT, MAPPING_PROJECTION, MATRIX, OUTPUT_PORT, VALUE) | ||
| from psyneulink.core.globals.log import ContextFlags | ||
| from psyneulink.core.globals.parameters import FunctionParameter, Parameter, check_user_specified, copy_parameter_value | ||
| from psyneulink.core.globals.parameters import FunctionParameter, Parameter, SharedParameter, check_user_specified, copy_parameter_value |
| # defer initialization until they are added | ||
| elif agent_rep.componentCategory=='Composition': | ||
| from psyneulink.core.compositions.composition import NodeRole | ||
| from psyneulink.core.compositions.noderoles import NodeRole |
Comment on lines
+1484
to
+1496
| # if isinstance(scale, numbers.Number): | ||
| # # scalar scale | ||
| # product = combination * scale | ||
| # else: | ||
| # # Hadamard scale | ||
| # product = np.prod([combination, scale], axis=0) | ||
| # | ||
| # if isinstance(offset, numbers.Number): | ||
| # # scalar offset | ||
| # result = product + offset | ||
| # else: | ||
| # # Hadamard offset | ||
| # result = np.sum([product, offset], axis=0) |
Comment on lines
+1377
to
+1380
| # elif loss == Loss.MSE: | ||
| # self.loss_function = Distance(metric=EUCLIDEAN, normalize=normalize) | ||
| # elif loss == Loss.CROSS_ENTROPY: | ||
| # self.loss_function = Distance(metric=CROSS_ENTROPY, normalize=normalize) |
| # to prevent immediate NaN propagation due to zero inputs. | ||
| GRU_INITIAL_STATE = np.random.uniform(low=-0.01, high=0.01, size=HIDDEN_DIMENSION) | ||
| try: gru_hidden_node.parameters.initial_value.set(GRU_INITIAL_STATE) | ||
| except Exception: pass |
| import numpy as np | ||
| import torch | ||
| import torch.nn as nn | ||
| import torch.nn.functional as F |
| import psyneulink as pnl | ||
| import numpy as np | ||
| import torch | ||
| import torch.nn as nn |
| @@ -0,0 +1,221 @@ | |||
| import psyneulink as pnl | |||
| import numpy as np | |||
| import torch | |||
|
|
||
| assert 0 <= integration_rate <= 1, \ | ||
| f"integrator_retrieval_weight must be a number from 0 to 1" | ||
| enable_learning = learning_rate > 0 |
|
This PR causes the following changes to the html docs (ubuntu-latest-3.11): See CI logs for the full diff. |
kmantel
self-requested a review
July 17, 2026 07:02
kmantel
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.