提交 ae9825c5 authored 作者: Razvan Pascanu's avatar Razvan Pascanu

Removed trailing spaces

上级 af0fbb52
...@@ -8,11 +8,11 @@ class SymbolicInput(object): ...@@ -8,11 +8,11 @@ class SymbolicInput(object):
""" """
Represents a symbolic input for use with function or FunctionMaker. Represents a symbolic input for use with function or FunctionMaker.
variable: a Variable instance. variable: a Variable instance.
This will be assigned a value before running the function, This will be assigned a value before running the function,
not computed from its owner. not computed from its owner.
name: Any type. (If autoname=True, defaults to variable.name). name: Any type. (If autoname=True, defaults to variable.name).
If name is a valid Python identifier, this input can be set by kwarg, and its value If name is a valid Python identifier, this input can be set by kwarg, and its value
can be accessed by self.<name>. can be accessed by self.<name>.
...@@ -41,9 +41,9 @@ class SymbolicInput(object): ...@@ -41,9 +41,9 @@ class SymbolicInput(object):
assert implicit is not None # Safety check. assert implicit is not None # Safety check.
self.variable = variable self.variable = variable
if (autoname and name is None): if (autoname and name is None):
self.name = variable.name self.name = variable.name
else: else:
self.name = name self.name = name
#backport #backport
#self.name = variable.name if (autoname and name is None) else name #self.name = variable.name if (autoname and name is None) else name
...@@ -131,11 +131,11 @@ class In(SymbolicInput): ...@@ -131,11 +131,11 @@ class In(SymbolicInput):
""" """
Represents a symbolic input for use with function or FunctionMaker. Represents a symbolic input for use with function or FunctionMaker.
variable: a Variable instance. variable: a Variable instance.
This will be assigned a value before running the function, This will be assigned a value before running the function,
not computed from its owner. not computed from its owner.
name: Any type. (If autoname=True, defaults to variable.name). name: Any type. (If autoname=True, defaults to variable.name).
If name is a valid Python identifier, this input can be set by kwarg, and its value If name is a valid Python identifier, this input can be set by kwarg, and its value
can be accessed by self.<name>. can be accessed by self.<name>.
...@@ -194,7 +194,7 @@ class SymbolicOutput(object): ...@@ -194,7 +194,7 @@ class SymbolicOutput(object):
returned for this output might be clobbered by running returned for this output might be clobbered by running
the function again, but the function might be faster. the function again, but the function might be faster.
""" """
def __init__(self, variable, borrow=False): def __init__(self, variable, borrow=False):
self.variable = variable self.variable = variable
self.borrow = borrow self.borrow = borrow
......
差异被折叠。
...@@ -898,24 +898,24 @@ class _tensor_py_operators: ...@@ -898,24 +898,24 @@ class _tensor_py_operators:
#COMPARISONS #COMPARISONS
_is_nonzero = True _is_nonzero = True
def __lt__(self,other): def __lt__(self,other):
rval = lt(self, other) rval = lt(self, other)
rval._is_nonzero=False rval._is_nonzero=False
return rval return rval
def __le__(self,other): def __le__(self,other):
rval = le(self, other) rval = le(self, other)
rval._is_nonzero=False rval._is_nonzero=False
return rval return rval
def __gt__(self,other): def __gt__(self,other):
rval = gt(self, other) rval = gt(self, other)
rval._is_nonzero=False rval._is_nonzero=False
return rval return rval
def __ge__(self,other): def __ge__(self,other):
rval = ge(self, other) rval = ge(self, other)
rval._is_nonzero=False rval._is_nonzero=False
return rval return rval
def __nonzero__(self): def __nonzero__(self):
# This is meant to prohibit stuff like a < b < c, which is internally implemented as # This is meant to prohibit stuff like a < b < c, which is internally implemented as
# (a < b) and (b < c). The trouble with this is the side-effect that checking for a # (a < b) and (b < c). The trouble with this is the side-effect that checking for a
# non-NULL a by typing "if a: ..." uses the same __nonzero__ method. We want these # non-NULL a by typing "if a: ..." uses the same __nonzero__ method. We want these
# both to work, but it seems impossible. Currently, all vars evaluate to nonzero # both to work, but it seems impossible. Currently, all vars evaluate to nonzero
...@@ -3962,7 +3962,7 @@ def tensordot(x, y, axes=2): ...@@ -3962,7 +3962,7 @@ def tensordot(x, y, axes=2):
raise ValueError('Cannot perform tensordot of 0-d inputs.') raise ValueError('Cannot perform tensordot of 0-d inputs.')
axes = TensorDot.parse_axes(axes) axes = TensorDot.parse_axes(axes)
# check whether axes is valid given the dimensions of x and y # check whether axes is valid given the dimensions of x and y
if numpy.isscalar(axes): if numpy.isscalar(axes):
if axes >= x.ndim or axes >= y.ndim: if axes >= x.ndim or axes >= y.ndim:
...@@ -3979,12 +3979,12 @@ def tensordot(x, y, axes=2): ...@@ -3979,12 +3979,12 @@ def tensordot(x, y, axes=2):
if isinstance(axes[1],(list,tuple)) and \ if isinstance(axes[1],(list,tuple)) and \
(len(axes[1]) > y.ndim or (numpy.array(axes[1]) >= y.ndim).any()): (len(axes[1]) > y.ndim or (numpy.array(axes[1]) >= y.ndim).any()):
raise ValueError('axes[1] should be array_like, of length smaller'\ raise ValueError('axes[1] should be array_like, of length smaller'\
'than the dimension of y (y.ndim=%i, len(axes[1])=%i).' % 'than the dimension of y (y.ndim=%i, len(axes[1])=%i).' %
(y.ndim, len(axes[1]))) (y.ndim, len(axes[1])))
if not hasattr(tensordot, 'op'): if not hasattr(tensordot, 'op'):
tensordot.op = {} tensordot.op = {}
if axes not in tensordot.op: if axes not in tensordot.op:
tensordot.op[axes] = TensorDot(axes) tensordot.op[axes] = TensorDot(axes)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论