提交 c1f0ce3a authored 作者: Olivier Breuleux's avatar Olivier Breuleux

re-added clone to env

上级 1e55dc82
...@@ -408,6 +408,18 @@ class Env(utils.object2): ...@@ -408,6 +408,18 @@ class Env(utils.object2):
return "[%s]" % ", ".join(graph.as_string(self.inputs, self.outputs)) return "[%s]" % ", ".join(graph.as_string(self.inputs, self.outputs))
### clone ###
def clone(self):
return self.clone_get_equiv()[0]
def clone_get_equiv(self):
g, equiv = graph.clone_get_equiv(self.inputs, self.outputs)
e = Env([equiv[i] for i in self.inputs],
[equiv[o] for o in self.outputs])
for feature in self._features:
e.extend(feature)
return e, equiv
......
...@@ -268,8 +268,15 @@ class MetaLinker(Linker): ...@@ -268,8 +268,15 @@ class MetaLinker(Linker):
pass pass
def make_thunk(self, **kwargs): def make_thunk(self, **kwargs):
"""
You can pass an alternate env to use with the 'alt_env'
option.
env = self.env The rest of the options will be passed to all the linkers
associated with this MetaLinker.
"""
env = kwargs.pop("alt_env", self.env)
no_recycling = self.no_recycling no_recycling = self.no_recycling
fns, input_lists, output_lists, thunk_lists, order_lists = zip(*[linker(env, no_recycling = no_recycling).make_all(**kwargs) fns, input_lists, output_lists, thunk_lists, order_lists = zip(*[linker(env, no_recycling = no_recycling).make_all(**kwargs)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论