Skip to content

Commit

Permalink
Composition: determine NodeRole.INTERNAL by not INPUT/OUTPUT
Browse files Browse the repository at this point in the history
newer documentation of NodeRole suggests INTERNAL should be determined
by not being INPUT or OUTPUT, not by not being ORIGIN or TERMINAL
  • Loading branch information
kmantel committed Nov 18, 2023
1 parent b61f894 commit d4a34b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions psyneulink/core/compositions/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -5204,7 +5204,12 @@ def _determine_node_roles(self, context=None):
- all Nodes that have one or more InputPorts for which default_input == DEFAULT_VARIABLE

INTERNAL:
- all Nodes that are *neither* ORIGIN nor TERMINAL
A `Node <Composition_Nodes>` that is neither `INPUT` nor
`OUTPUT`. Note that it *can* also be `ORIGIN`, `TERMINAL`
or `SINGLETON`, if it has no `afferent
<Mechanism_Base.afferents>` or `efferent
<Mechanism_Base.efferents>` Projections or neither,
respectively. This role cannot be modified programmatically.

CYCLE:
- all Nodes that identified as being in a cycle by self.graph_processing
Expand Down Expand Up @@ -5473,7 +5478,7 @@ def is_output_node(node, allow_cycle=False):
for node in self.nodes:
if all(n in self.nodes_to_roles[node] for n in {NodeRole.ORIGIN, NodeRole.TERMINAL}):
self._add_node_role(node, NodeRole.SINGLETON)
if not any(n in self.nodes_to_roles[node] for n in {NodeRole.ORIGIN, NodeRole.TERMINAL}):
if not any(n in self.nodes_to_roles[node] for n in {NodeRole.INPUT, NodeRole.OUTPUT}):
self._add_node_role(node, NodeRole.INTERNAL)

# Finally, remove any NodeRole assignments specified in excluded_node_roles
Expand Down

0 comments on commit d4a34b7

Please sign in to comment.