From d4a34b713e4596f3e20a811b2f5267885936c7b9 Mon Sep 17 00:00:00 2001 From: Katherine Mantel Date: Sat, 18 Nov 2023 05:52:18 +0000 Subject: [PATCH] Composition: determine NodeRole.INTERNAL by not INPUT/OUTPUT newer documentation of NodeRole suggests INTERNAL should be determined by not being INPUT or OUTPUT, not by not being ORIGIN or TERMINAL --- psyneulink/core/compositions/composition.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/psyneulink/core/compositions/composition.py b/psyneulink/core/compositions/composition.py index 297f1e92bb2..bd6bd4cdcae 100644 --- a/psyneulink/core/compositions/composition.py +++ b/psyneulink/core/compositions/composition.py @@ -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 ` that is neither `INPUT` nor + `OUTPUT`. Note that it *can* also be `ORIGIN`, `TERMINAL` + or `SINGLETON`, if it has no `afferent + ` or `efferent + ` Projections or neither, + respectively. This role cannot be modified programmatically. CYCLE: - all Nodes that identified as being in a cycle by self.graph_processing @@ -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