提交 f55d2fdd authored 作者: James Bergstra's avatar James Bergstra

added mode_default, with value FAST_COMPILE

上级 cf22caab
......@@ -16,6 +16,9 @@ from mode import *
from io import *
# used by function and module as the default compilation mode
mode_default = 'FAST_COMPILE'
def infer_reuse_pattern(env, outputs_to_disown):
"""
Given an env and a list of results, returns the list of all
......@@ -451,7 +454,7 @@ class FunctionMaker(object):
raise TypeError("Unknown output type: %s (%s)", type(output), output)
def __init__(self, inputs, outputs,
mode = 'FAST_COMPILE', accept_inplace = False, function_builder = Function):
mode = mode_default, accept_inplace = False, function_builder = Function):
"""
:type inputs: a list of SymbolicInput instances
......@@ -641,7 +644,7 @@ def register_checker(checker):
def function(inputs, outputs, mode='FAST_RUN', accept_inplace = False):
def function(inputs, outputs, mode=mode_default, accept_inplace = False):
"""
Return a function calculating the outputs from the inputs.
......
......@@ -125,7 +125,7 @@ class Component(object):
"""
raise NotImplementedError
def make_no_init(self, mode='FAST_COMPILE'):
def make_no_init(self, mode=F.mode_default):
"""
Allocates the necessary containers using allocate() and uses
build() with the provided mode to make an instance which will
......@@ -145,7 +145,7 @@ class Component(object):
arguments and the keyword arguments. If 'mode' is in the
keyword arguments it will be passed to build().
"""
mode = kwargs.pop('mode', 'FAST_COMPILE')
mode = kwargs.pop('mode', F.mode_default)
rval = self.make_no_init(mode)
if hasattr(rval, 'initialize'):
rval.initialize(*args, **kwargs)
......@@ -956,7 +956,7 @@ class Module(ComponentDict):
"""
self.make_mi(args,kwargs)
mode = kwargs.pop('mode', 'FAST_COMPILE')
mode = kwargs.pop('mode', F.mode_default)
rval = self.make_no_init(mode)
if hasattr(rval, 'initialize'):
rval.initialize(*args, **kwargs)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论