提交 8ac5ab98 authored 作者: David Warde-Farley's avatar David Warde-Farley

Yet more dangerous default arguments.

上级 7f090ddd
...@@ -504,9 +504,9 @@ def char_from_number(number): ...@@ -504,9 +504,9 @@ def char_from_number(number):
def debugprint(r, prefix='', depth=-1, done=None, print_type=False, def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
file=sys.stdout, print_destroy_map=False, print_view_map=False, file=sys.stdout, print_destroy_map=False,
order=[], ids='CHAR', stop_on_name=False, print_view_map=False, order=None, ids='CHAR',
prefix_child=None): stop_on_name=False, prefix_child=None):
"""Print the graph leading to `r` to given depth. """Print the graph leading to `r` to given depth.
:param r: Variable instance :param r: Variable instance
...@@ -531,6 +531,9 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False, ...@@ -531,6 +531,9 @@ def debugprint(r, prefix='', depth=-1, done=None, print_type=False,
if depth == 0: if depth == 0:
return return
if order is None:
order = []
if done is None: if done is None:
done = dict() done = dict()
......
...@@ -1411,7 +1411,8 @@ class GCC_compiler(object): ...@@ -1411,7 +1411,8 @@ class GCC_compiler(object):
@staticmethod @staticmethod
def compile_str(module_name, src_code, location=None, def compile_str(module_name, src_code, location=None,
include_dirs=[], lib_dirs=[], libs=[], preargs=[]): include_dirs=None, lib_dirs=None, libs=None,
preargs=None):
""" """
:param module_name: string (this has been embedded in the src_code :param module_name: string (this has been embedded in the src_code
...@@ -1435,6 +1436,12 @@ class GCC_compiler(object): ...@@ -1435,6 +1436,12 @@ class GCC_compiler(object):
""" """
#TODO: Do not do the dlimport in this function #TODO: Do not do the dlimport in this function
if include_dirs is None:
preargs = []
if lib_dirs is None:
lib_dirs = []
if libs is None:
libs = []
if preargs is None: if preargs is None:
preargs = [] preargs = []
else: else:
......
...@@ -54,7 +54,9 @@ def theano_parse_c_arg(c_arg): ...@@ -54,7 +54,9 @@ def theano_parse_c_arg(c_arg):
""" """
class TheanoElementwiseKernel(pycuda.elementwise.ElementwiseKernel): class TheanoElementwiseKernel(pycuda.elementwise.ElementwiseKernel):
def __init__(self, arguments, operation, def __init__(self, arguments, operation,
name="kernel", keep=False, options=[], **kwargs): name="kernel", keep=False, options=None, **kwargs):
if options is None:
options = []
if isinstance(arguments, basestring): if isinstance(arguments, basestring):
arguments = [theano_parse_c_arg(arg) arguments = [theano_parse_c_arg(arg)
for arg in arguments.split(",")] for arg in arguments.split(",")]
......
...@@ -10,12 +10,16 @@ class DebugLinker(gof.WrapLinker): ...@@ -10,12 +10,16 @@ class DebugLinker(gof.WrapLinker):
def __init__(self, def __init__(self,
linkers, linkers,
debug_pre = [], debug_pre=None,
debug_post = [], debug_post=None,
copy_originals = False, copy_originals=False,
check_types = True, check_types=True,
compare_variables = True, compare_variables=True,
compare_fn = (lambda x, y: x == y)): compare_fn=(lambda x, y: x == y)):
if debug_pre is None:
debug_pre = []
if debug_post is None:
debug_post = []
gof.WrapLinker.__init__(self, gof.WrapLinker.__init__(self,
linkers = linkers, linkers = linkers,
wrapper = self.wrapper) wrapper = self.wrapper)
......
...@@ -4089,7 +4089,9 @@ class IncSubtensor(Op): ...@@ -4089,7 +4089,9 @@ class IncSubtensor(Op):
""" """
def __init__(self, idx_list, inplace=False, set_instead_of_inc=False, def __init__(self, idx_list, inplace=False, set_instead_of_inc=False,
destroyhandler_tolerate_aliased=[]): destroyhandler_tolerate_aliased=None):
if destroyhandler_tolerate_aliased is None:
destroyhandler_tolerate_aliased = []
self.idx_list = map(Subtensor.convert, idx_list) self.idx_list = map(Subtensor.convert, idx_list)
self.inplace = inplace self.inplace = inplace
if inplace: if inplace:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论