提交 84ba2625 authored 作者: Frederic's avatar Frederic

make linker=py use the theano flag allow_gc. It don't change the default.

Also add doc about witch linker support allow_gc.
上级 d8a60f88
...@@ -64,13 +64,13 @@ def check_equal(x, y): ...@@ -64,13 +64,13 @@ def check_equal(x, y):
# Mode, it will be used as the key to retrieve the real linker in this # Mode, it will be used as the key to retrieve the real linker in this
# dictionary # dictionary
predefined_linkers = { predefined_linkers = {
'py': gof.PerformLinker(), 'py': gof.PerformLinker(), # Use allow_gc Theano flag
'c': gof.CLinker(), 'c': gof.CLinker(), # Don't support gc. so don't check allow_gc
'c|py': gof.OpWiseCLinker(), 'c|py': gof.OpWiseCLinker(), # Use allow_gc Theano flag
'c|py_nogc': gof.OpWiseCLinker(allow_gc=False), 'c|py_nogc': gof.OpWiseCLinker(allow_gc=False),
'c&py': gof.DualLinker(checker=check_equal), 'c&py': gof.DualLinker(checker=check_equal), # Deprecated
'vm': gof.vm.VM_Linker(use_cloop=False), 'vm': gof.vm.VM_Linker(use_cloop=False), # Use allow_gc Theano flag
'cvm': gof.vm.VM_Linker(use_cloop=True), 'cvm': gof.vm.VM_Linker(use_cloop=True), # Use allow_gc Theano flag
'vm_nogc': gof.vm.VM_Linker(allow_gc=False, use_cloop=False), 'vm_nogc': gof.vm.VM_Linker(allow_gc=False, use_cloop=False),
'cvm_nogc': gof.vm.VM_Linker(allow_gc=False, use_cloop=True), 'cvm_nogc': gof.vm.VM_Linker(allow_gc=False, use_cloop=True),
} }
......
"""WRITEME""" """WRITEME"""
import theano
from theano.gof import utils from theano.gof import utils
from theano.gof import graph from theano.gof import graph
from theano.gof.type import Type from theano.gof.type import Type
...@@ -419,8 +420,9 @@ class PerformLinker(LocalLinker): ...@@ -419,8 +420,9 @@ class PerformLinker(LocalLinker):
the L{FunctionGraph} in the order given by L{Linker.schedule}. the L{FunctionGraph} in the order given by L{Linker.schedule}.
""" """
def __init__(self, allow_gc=True, schedule=None): def __init__(self, allow_gc=None, schedule=None):
#TODO: set allow_gc = True by default, when it works with the OpWiseCLinker if allow_gc is None:
allow_gc = theano.config.allow_gc
self.fgraph = None self.fgraph = None
self.allow_gc = allow_gc self.allow_gc = allow_gc
if schedule: if schedule:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论