File tree Expand file tree Collapse file tree 1 file changed +0
-35
lines changed Expand file tree Collapse file tree 1 file changed +0
-35
lines changed Original file line number Diff line number Diff line change @@ -2069,38 +2069,3 @@ def expand(r) -> list[Variable] | None:
20692069 results += (var ,)
20702070
20712071 return results
2072-
2073-
2074- def replace_nominals_with_dummies (inputs , outputs ):
2075- """Replace nominal inputs with dummy variables.
2076-
2077- When constructing a new graph with nominal inputs from an existing graph,
2078- pre-existing nominal inputs need to be replaced with dummy variables
2079- beforehand; otherwise, sequential ID ordering (i.e. when nominals are IDed
2080- based on the ordered inputs to which they correspond) of the nominals could
2081- be broken, and/or circular replacements could manifest.
2082-
2083- FYI: This function assumes that all the nominal variables in the subgraphs
2084- between `inputs` and `outputs` are present in `inputs`.
2085-
2086- """
2087- existing_nominal_replacements = {
2088- i : i .type () for i in inputs if isinstance (i , NominalVariable )
2089- }
2090-
2091- if existing_nominal_replacements :
2092- # Replace existing nominal variables, because we need to produce an
2093- # inner-graph for which the nominal variable IDs correspond exactly
2094- # to their input order
2095- _ = clone_get_equiv (
2096- inputs ,
2097- outputs ,
2098- copy_inputs = False ,
2099- copy_orphans = False ,
2100- memo = existing_nominal_replacements ,
2101- )
2102-
2103- outputs = [existing_nominal_replacements [o ] for o in outputs ]
2104- inputs = [existing_nominal_replacements [i ] for i in inputs ]
2105-
2106- return inputs , outputs
You can’t perform that action at this time.
0 commit comments