提交 c2a526cc authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Cosmetic changes

上级 f0f84950
......@@ -531,28 +531,28 @@ class Function(object):
for k, arg in kwargs.iteritems():
self[k] = arg
## Collect aliased inptus among the storage space
## Collect aliased inputs among the storage space
args_share_memory = []
for i in xrange(len(self.input_storage)):
if self.input_storage[i].storage[0] != None:
if self.input_storage[i].storage[0] is not None:
is_aliased = False
for j in xrange(len(args_share_memory)):
if numpy.may_share_memory(
if numpy.may_share_memory(
self.input_storage[i].storage[0] ,
self.input_storage[args_share_memory[j][0]].storage[0]):
is_aliased = True
args_share_memory[j] += [i]
args_share_memory[j].append(i)
break
if not is_aliased:
args_share_memory.append( [i] )
args_share_memory.append([i])
# Check for groups of more than one argument that share memory
for group in args_share_memory:
if len(group) > 1:
# see if any of these arguments are mutable
mutable = numpy.any( [self.maker.inputs[idx].mutable for
idx in group])
mutable = numpy.any([self.maker.inputs[idx].mutable
for idx in group])
# copy all but the first
for idx in group[1:]:
self.input_storage[i].storage[0] = copy.copy(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论