提交 bbbac983 authored 作者: Frederic's avatar Frederic

Make DebugMode _Maker interface more similar to FunctionMaker

上级 4e0fb124
...@@ -2403,13 +2403,15 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions ...@@ -2403,13 +2403,15 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
""" """
def __init__(self, inputs, outputs, optimizer, mode, def __init__(self, inputs, outputs, mode,
accept_inplace=False, accept_inplace=False,
function_builder=Function, function_builder=Function,
profile=None, profile=None,
on_unused_input=None, on_unused_input=None,
fgraph=None, # If present the optimized graph. we ignore it.
output_keys=None): output_keys=None):
self.profile = profile self.profile = profile
optimizer = mode.optimizer
# Handle the case where inputs and/or outputs is a single # Handle the case where inputs and/or outputs is a single
# Variable (not in a list) # Variable (not in a list)
unpack_single = False unpack_single = False
...@@ -2523,6 +2525,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions ...@@ -2523,6 +2525,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
self.accept_inplace = accept_inplace self.accept_inplace = accept_inplace
self.function_builder = function_builder self.function_builder = function_builder
self.mode = mode self.mode = mode
self.on_unused_input = on_unused_input # Used for the pickling/copy
self.output_keys = output_keys self.output_keys = output_keys
def create(self, defaults=None, trustme=False, storage_map=None): def create(self, defaults=None, trustme=False, storage_map=None):
...@@ -2744,7 +2747,7 @@ class DebugMode(Mode): ...@@ -2744,7 +2747,7 @@ class DebugMode(Mode):
""" """
assert m is self assert m is self
return _Maker(i, o, self.optimizer, self, *args, **kwargs) return _Maker(i, o, self, *args, **kwargs)
def __init__(self, def __init__(self,
optimizer='fast_run', optimizer='fast_run',
......
...@@ -1497,7 +1497,7 @@ class FunctionMaker(object): ...@@ -1497,7 +1497,7 @@ class FunctionMaker(object):
self.mode = mode self.mode = mode
self.accept_inplace = accept_inplace self.accept_inplace = accept_inplace
self.function_builder = function_builder self.function_builder = function_builder
self.on_unused_input = on_unused_input # Used only for the pickling self.on_unused_input = on_unused_input # Used for the pickling/copy
self.output_keys = output_keys self.output_keys = output_keys
self.required = [(i.value is None) for i in self.inputs] self.required = [(i.value is None) for i in self.inputs]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论