提交 852114f3 authored 作者: Frederic's avatar Frederic

pep8

上级 ac850ee6
...@@ -1296,7 +1296,7 @@ class IncSubtensor(Op): ...@@ -1296,7 +1296,7 @@ class IncSubtensor(Op):
** helper_args ** helper_args
) )
#Make a view on the output, as we will write into it. # Make a view on the output, as we will write into it.
alloc_zview = self.make_view_array(z, view_ndim) alloc_zview = self.make_view_array(z, view_ndim)
build_view = """ build_view = """
...@@ -1545,7 +1545,8 @@ class AdvancedSubtensor1(Op): ...@@ -1545,7 +1545,8 @@ class AdvancedSubtensor1(Op):
if not numpy.can_cast(i.dtype, numpy.intp): if not numpy.can_cast(i.dtype, numpy.intp):
# Check if there was actually an incorrect conversion # Check if there was actually an incorrect conversion
if numpy.any(i != i_): if numpy.any(i != i_):
raise IndexError('index contains values that are bigger ' raise IndexError(
'index contains values that are bigger '
'than the maximum array size on this system.', i) 'than the maximum array size on this system.', i)
i = i_ i = i_
...@@ -1737,7 +1738,8 @@ class AdvancedIncSubtensor1(Op): ...@@ -1737,7 +1738,8 @@ class AdvancedIncSubtensor1(Op):
opname = 'set' opname = 'set'
else: else:
opname = 'increment' opname = 'increment'
raise TypeError('cannot %s x subtensor with ndim=%s' raise TypeError(
'cannot %s x subtensor with ndim=%s'
' by y with ndim=%s to x subtensor with ndim=%s ' % ( ' by y with ndim=%s to x subtensor with ndim=%s ' % (
opname, x_.type.ndim, y_.type.ndim)) opname, x_.type.ndim, y_.type.ndim))
...@@ -1842,7 +1844,7 @@ def adv_index_broadcastable_pattern(a, idx): ...@@ -1842,7 +1844,7 @@ def adv_index_broadcastable_pattern(a, idx):
newidx = tuple(map(replace_slice, idx)) newidx = tuple(map(replace_slice, idx))
#2 - True = 1; 2 - False = 2 # 2 - True = 1; 2 - False = 2
fakeshape = [2 - bc for bc in a.broadcastable] fakeshape = [2 - bc for bc in a.broadcastable]
retshape = numpy.empty(fakeshape)[newidx].shape retshape = numpy.empty(fakeshape)[newidx].shape
return tuple([dim == 1 for dim in retshape]) return tuple([dim == 1 for dim in retshape])
...@@ -1907,8 +1909,6 @@ class AdvancedSubtensor(Op): ...@@ -1907,8 +1909,6 @@ class AdvancedSubtensor(Op):
'are too big (>= 2^32 elements). It is possible that ' 'are too big (>= 2^32 elements). It is possible that '
'out[0] (%s), with shape %s, is not correctly filled.' 'out[0] (%s), with shape %s, is not correctly filled.'
% (out[0], out[0].shape)) % (out[0], out[0].shape))
# return
#raise NotImplementedError()
def connection_pattern(self, node): def connection_pattern(self, node):
...@@ -1961,7 +1961,8 @@ class AdvancedIncSubtensor(Op): ...@@ -1961,7 +1961,8 @@ class AdvancedIncSubtensor(Op):
def __str__(self): def __str__(self):
return "%s{%s, %s}" % (self.__class__.__name__, return "%s{%s, %s}" % (self.__class__.__name__,
"inplace=" + str(self.inplace), "inplace=" + str(self.inplace),
" set_instead_of_inc=" + str(self. set_instead_of_inc)) " set_instead_of_inc=" +
str(self. set_instead_of_inc))
def make_node(self, x, y, *inputs): def make_node(self, x, y, *inputs):
x = theano.tensor.as_tensor_variable(x) x = theano.tensor.as_tensor_variable(x)
...@@ -2004,7 +2005,8 @@ class AdvancedIncSubtensor(Op): ...@@ -2004,7 +2005,8 @@ class AdvancedIncSubtensor(Op):
return gof.Apply(op, return gof.Apply(op,
(x, y) + inputs, (x, y) + inputs,
[theano.tensor.tensor(dtype=x.type.dtype, [theano.tensor.tensor(
dtype=x.type.dtype,
broadcastable=x.type.broadcastable)]) broadcastable=x.type.broadcastable)])
def perform(self, node, inputs, out_): def perform(self, node, inputs, out_):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论