提交 9318a8ab authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Remove unnecessary comments and deprecated PreserveNames Feature

上级 c074ec34
...@@ -328,20 +328,10 @@ class Feature: ...@@ -328,20 +328,10 @@ class Feature:
class Bookkeeper(Feature): class Bookkeeper(Feature):
def on_attach(self, fgraph): def on_attach(self, fgraph):
"""
Called by FunctionGraph.attach_feature, the method that attaches
the feature to the FunctionGraph. Since this is called after the
FunctionGraph is initially populated, this is where you should
run checks on the initial contents of the FunctionGraph.
"""
for node in io_toposort(fgraph.inputs, fgraph.outputs): for node in io_toposort(fgraph.inputs, fgraph.outputs):
self.on_import(fgraph, node, "on_attach") self.on_import(fgraph, node, "on_attach")
def on_detach(self, fgraph): def on_detach(self, fgraph):
"""
Should remove any dynamically added functionality
that it installed into the function_graph
"""
for node in io_toposort(fgraph.inputs, fgraph.outputs): for node in io_toposort(fgraph.inputs, fgraph.outputs):
self.on_prune(fgraph, node, "Bookkeeper.detach") self.on_prune(fgraph, node, "Bookkeeper.detach")
...@@ -738,18 +728,6 @@ class PrintListener(Feature): ...@@ -738,18 +728,6 @@ class PrintListener(Feature):
print(f"-- changing ({node}.inputs[{i}]) from {r} to {new_r}") print(f"-- changing ({node}.inputs[{i}]) from {r} to {new_r}")
class PreserveNames(Feature):
"""
This preserve some variables names during optimization.
Deprecated. We need to keep it to allow unpickling.
"""
def on_change_input(self, fgraph, node, i, r, new_r, reason=None):
if r.name is not None and new_r.name is None:
new_r.name = r.name
class PreserveVariableAttributes(Feature): class PreserveVariableAttributes(Feature):
""" """
This preserve some variables attributes and tag during optimization. This preserve some variables attributes and tag during optimization.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论