(self, graph)
| 175 | self.name = re.compile(name) if name else None |
| 176 | |
| 177 | def apply(self, graph): |
| 178 | # Copy the graph. Don't change the original. |
| 179 | graph = copy.deepcopy(graph) |
| 180 | |
| 181 | for node in graph.nodes.values(): |
| 182 | if self.op: |
| 183 | node.op = self.op.sub(self.to, node.op) |
| 184 | # TODO: name is not tested yet |
| 185 | if self.name: |
| 186 | node.name = self.name.sub(self.to, node.name) |
| 187 | return graph |
| 188 | |
| 189 | |
| 190 | # Transforms to simplify graphs by folding layers that tend to be |