TMaddox commented on a change in pull request #1234:
URL: https://github.com/apache/systemds/pull/1234#discussion_r619852374



##########
File path: src/main/python/systemds/script_building/script.py
##########
@@ -178,24 +178,30 @@ def _dfs_dag_nodes(self, dag_node: VALID_INPUT_TYPES) -> 
str:
         :param dag_node: current DAG node
         :return: the variable name the current DAG node operation created
         """
+
         if not isinstance(dag_node, DAGNode):
             if isinstance(dag_node, bool):
                 return 'TRUE' if dag_node else 'FALSE'
             return str(dag_node)
-        # for each node do the dfs operation and save the variable names in 
`input_var_names`
+
+        if dag_node.dml_name != "":
+            return dag_node.dml_name
+
         # get variable names of unnamed parameters
-        unnamed_input_vars = [self._dfs_dag_nodes(
-            input_node) for input_node in dag_node.unnamed_input_nodes]
+        unnamed_input_vars = [self._dfs_dag_nodes(input_node) for input_node 
in dag_node.unnamed_input_nodes]
         # get variable names of named parameters
-        named_input_vars = {name: self._dfs_dag_nodes(input_node) for name, 
input_node in
-                            dag_node.named_input_nodes.items()}
-        curr_var_name = self._next_unique_var()
+        named_input_vars = {}
+        for name, input_node in dag_node.named_input_nodes.items():
+            named_input_vars[name] = self._dfs_dag_nodes(input_node)
+            if isinstance(input_node, DAGNode) and 
len(input_node.output_nodes) > 1:
+                named_input_vars[name] = named_input_vars[name] + name

Review comment:
       in your scripts you use [V2_0, V2_1] as a result of operations with 
multiple outputs. I am leveraging this to reduce complexity in the built 
scripts. The alternative would be to do this: V3 = V2_0; V4=V2_1, which 
increases the amount of variables in the scripts
   
   name in this context ([V2_0, V2_1]) is the name of the output node edge, 
which is _0 and _1 in this case 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to