Skip to content

Commit

Permalink
Composition: set most_recent_context in execute
Browse files Browse the repository at this point in the history
- other Components generally set in their execute methods
- setting only in Composition.run fails to set when a Composition is
nested, because only execute gets called
- must still be set in Composition.run in case Composition is empty
  • Loading branch information
kmantel committed Feb 15, 2025
1 parent 05b8dfb commit 0ee661d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions psyneulink/core/compositions/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -12689,6 +12689,8 @@ def execute(

execution_scheduler.get_clock(context)._increment_time(TimeScale.TRIAL)

self.most_recent_context = context

# Extract result here
if execution_mode.is_compiled():
assert execution_mode & pnlvm.ExecutionMode._PerNode
Expand Down
1 change: 1 addition & 0 deletions psyneulink/library/compositions/autodiffcomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,7 @@ def execute(self,

scheduler.get_clock(context)._increment_time(TimeScale.TRIAL)

self.most_recent_context = context
return all_output_values

# Call Composition execute in Python mode
Expand Down

0 comments on commit 0ee661d

Please sign in to comment.