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

added the option to have None for the outputs to debugmode

上级 18205006
...@@ -965,6 +965,10 @@ class _Maker(FunctionMaker): #inheritance buys a few helper functions ...@@ -965,6 +965,10 @@ class _Maker(FunctionMaker): #inheritance buys a few helper functions
# Handle the case where inputs and/or outputs is a single Variable (not in a list) # Handle the case where inputs and/or outputs is a single Variable (not in a list)
unpack_single = False unpack_single = False
return_none = False
if outputs is None:
return_none = True
outputs = []
if not isinstance(outputs, (list, tuple)): if not isinstance(outputs, (list, tuple)):
unpack_single = True unpack_single = True
outputs = [outputs] outputs = [outputs]
...@@ -1025,6 +1029,7 @@ class _Maker(FunctionMaker): #inheritance buys a few helper functions ...@@ -1025,6 +1029,7 @@ class _Maker(FunctionMaker): #inheritance buys a few helper functions
self.expanded_inputs = expanded_inputs self.expanded_inputs = expanded_inputs
self.outputs = outputs self.outputs = outputs
self.unpack_single = unpack_single self.unpack_single = unpack_single
self.return_none = return_none
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
...@@ -1120,7 +1125,7 @@ class _Maker(FunctionMaker): #inheritance buys a few helper functions ...@@ -1120,7 +1125,7 @@ class _Maker(FunctionMaker): #inheritance buys a few helper functions
# Get a function instance # Get a function instance
_fn, _i, _o = self.linker.make_thunk(input_storage = input_storage) _fn, _i, _o = self.linker.make_thunk(input_storage = input_storage)
fn = self.function_builder(_fn, _i, _o, self.indices, self.outputs, defaults, self.unpack_single, self) fn = self.function_builder(_fn, _i, _o, self.indices, self.outputs, defaults, self.unpack_single, self.return_none, self)
return fn return fn
def _pickle_DebugMode_Maker(maker): def _pickle_DebugMode_Maker(maker):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论