提交 08bd312a authored 作者: serdyuk's avatar serdyuk

Removed comparisons with None

上级 5c9e0b31
...@@ -1069,7 +1069,7 @@ class FunctionMaker(object): ...@@ -1069,7 +1069,7 @@ class FunctionMaker(object):
if hasattr(remove, 'fgraph'): if hasattr(remove, 'fgraph'):
del remove.fgraph del remove.fgraph
if hasattr(remove, 'owner'): if hasattr(remove, 'owner'):
if remove.owner == None: if remove.owner is None:
pass pass
else: else:
if hasattr(remove.owner, 'fgraph'): if hasattr(remove.owner, 'fgraph'):
......
...@@ -28,7 +28,7 @@ def checkfor(testcase, fn, E): ...@@ -28,7 +28,7 @@ def checkfor(testcase, fn, E):
# we got the exception we wanted # we got the exception we wanted
return return
else: else:
# we did not get the exception we wanted # we did not getishe exception we wanted
raise raise
# fn worked, but it shouldn't have # fn worked, but it shouldn't have
testcase.fail() testcase.fail()
......
...@@ -1627,7 +1627,7 @@ class SpSum(gof.op.Op): ...@@ -1627,7 +1627,7 @@ class SpSum(gof.op.Op):
return gof.Apply(self, [x], [z]) return gof.Apply(self, [x], [z])
def perform(self, node, (x,), (z,)): def perform(self, node, (x,), (z,)):
if self.axis == None: if self.axis is None:
z[0] = numpy.asarray(x.sum()) z[0] = numpy.asarray(x.sum())
else: else:
z[0] = numpy.asarray(x.sum(self.axis)).ravel() z[0] = numpy.asarray(x.sum(self.axis)).ravel()
......
...@@ -670,7 +670,7 @@ def norm(x,ord): ...@@ -670,7 +670,7 @@ def norm(x,ord):
if ndim == 0: if ndim == 0:
raise ValueError("'axis' entry is out of bounds.") raise ValueError("'axis' entry is out of bounds.")
elif ndim == 1: elif ndim == 1:
if ord == None: if ord is None:
return tensor.sum(x**2)**0.5 return tensor.sum(x**2)**0.5
elif ord == 'inf': elif ord == 'inf':
return tensor.max(abs(x)) return tensor.max(abs(x))
...@@ -685,7 +685,7 @@ def norm(x,ord): ...@@ -685,7 +685,7 @@ def norm(x,ord):
raise ValueError("Invalid norm order for vectors.") raise ValueError("Invalid norm order for vectors.")
return z return z
elif ndim == 2: elif ndim == 2:
if ord == None or ord == 'fro': if ord is None or ord == 'fro':
return tensor.sum(abs(x**2))**(0.5) return tensor.sum(abs(x**2))**(0.5)
elif ord == 'inf': elif ord == 'inf':
return tensor.max(tensor.sum(abs(x), 1)) return tensor.max(tensor.sum(abs(x), 1))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论