def __init__(self): self.graph = c_api.TF_NewGraph() # Note: when we're destructing the global context (i.e when the process is # terminating) we may have already deleted other modules. By capturing the # DeleteGraph function here, we retain the ability to cleanly destroy the # graph at shutdown, which satisfies leak checkers. self.deleter = c_api.TF_DeleteGraph
def __init__(self, name): super(ScopedTFGraph, self).__init__( name, obj=c_api.TF_NewGraph(), deleter=c_api.TF_DeleteGraph)