提交 09992057 authored 作者: ChienliMa's avatar ChienliMa

change indent

上级 af1f4045
...@@ -2633,7 +2633,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions ...@@ -2633,7 +2633,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
defaults = _defaults defaults = _defaults
# 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,
storage_map=storage_map) storage_map=storage_map)
fn = self.function_builder(_fn, _i, _o, self.indices, fn = self.function_builder(_fn, _i, _o, self.indices,
self.outputs, defaults, self.unpack_single, self.outputs, defaults, self.unpack_single,
......
...@@ -552,13 +552,13 @@ class Function(object): ...@@ -552,13 +552,13 @@ class Function(object):
def copy(self, share_memory=False): def copy(self, share_memory=False):
""" """
Copy this function. Copied function will have separated maker and Copy this function. Copied function will have separated maker and
fgraph with original function. User can choose whether to separate fgraph with original function. User can choose whether to separate
storage by changing the share_memory arguments storage by changing the share_memory arguments
--------------------- ---------------------
Params: Params:
share_memory -- { boolean } Default is False. When True, two share_memory -- { boolean } Default is False. When True, two
function share intermediate storages(storages except input and function share intermediate storages(storages except input and
output storages) output storages)
--------------------- ---------------------
Returns: Returns:
...@@ -579,12 +579,12 @@ class Function(object): ...@@ -579,12 +579,12 @@ class Function(object):
# so that the ensuing function shares storage with the original one # so that the ensuing function shares storage with the original one
new_storage_map = {} new_storage_map = {}
storage_map = self.fn.storage_map storage_map = self.fn.storage_map
# TODO: We could share the output storage, but we must make sure # TODO: We could share the output storage, but we must make sure
# 2 different function call won't override each other values. This # 2 different function call won't override each other values. This
# is already done elsewhere, so to reuse it the user would need to # is already done elsewhere, so to reuse it the user would need to
# use Out(var, borrow=True) and maybe the mutable=True flag too. # use Out(var, borrow=True) and maybe the mutable=True flag too.
# But to be safe for now as it isn't documented and we aren't sure # But to be safe for now as it isn't documented and we aren't sure
# it is well tested, we don't share the part of the storage_map. # it is well tested, we don't share the part of the storage_map.
for key in storage_map.keys(): for key in storage_map.keys():
if key not in maker.fgraph.outputs: if key not in maker.fgraph.outputs:
...@@ -594,15 +594,15 @@ class Function(object): ...@@ -594,15 +594,15 @@ class Function(object):
input_storage = [] input_storage = []
for i in maker.inputs: for i in maker.inputs:
storage = getattr(i, 'value', None) storage = getattr(i, 'value', None)
if isinstance(i.variable, theano.tensor.Constant) or\ if isinstance(i.variable, theano.tensor.Constant) or \
not i.mutable: not i.mutable:
input_storage.append(storage) input_storage.append(storage)
else: else:
input_storage.append(copy.deepcopy[storage]) input_storage.append(copy.deepcopy[storage])
# reinitialize new maker and create new function # reinitialize new maker and create new function
return maker.__class__(inputs=ins, outputs=outs, fgraph=fg_cpy, return maker.__class__(inputs=ins, outputs=outs, fgraph=fg_cpy,
mode=maker.mode, profile=maker.profile, mode=maker.mode, profile=maker.profile,
on_unused_input=maker.on_unused_input, on_unused_input=maker.on_unused_input,
function_builder=maker.function_builder, function_builder=maker.function_builder,
accept_inplace=maker.accept_inplace).create( accept_inplace=maker.accept_inplace).create(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论