提交 30cfad4b authored 作者: Brandon T. Willard's avatar Brandon T. Willard

Apply pyupgrade to tests.d3viz

上级 bbb8e009
import numpy as np import numpy as np
from six import integer_types
import theano import theano
import theano.tensor as tt import theano.tensor as tt
class Mlp(object): class Mlp:
def __init__(self, nfeatures=100, noutputs=10, nhiddens=50, rng=None): def __init__(self, nfeatures=100, noutputs=10, nhiddens=50, rng=None):
if rng is None: if rng is None:
rng = 0 rng = 0
if isinstance(rng, integer_types): if isinstance(rng, int):
rng = np.random.RandomState(rng) rng = np.random.RandomState(rng)
self.rng = rng self.rng = rng
self.nfeatures = nfeatures self.nfeatures = nfeatures
...@@ -29,7 +28,7 @@ class Mlp(object): ...@@ -29,7 +28,7 @@ class Mlp(object):
self.outputs = [y] self.outputs = [y]
class OfgNested(object): class OfgNested:
def __init__(self): def __init__(self):
x, y, z = tt.scalars("xyz") x, y, z = tt.scalars("xyz")
e = x * y e = x * y
...@@ -42,7 +41,7 @@ class OfgNested(object): ...@@ -42,7 +41,7 @@ class OfgNested(object):
self.outputs = [e3] self.outputs = [e3]
class Ofg(object): class Ofg:
def __init__(self): def __init__(self):
x, y, z = tt.scalars("xyz") x, y, z = tt.scalars("xyz")
e = tt.nnet.sigmoid((x + y + z) ** 2) e = tt.nnet.sigmoid((x + y + z) ** 2)
...@@ -53,7 +52,7 @@ class Ofg(object): ...@@ -53,7 +52,7 @@ class Ofg(object):
self.outputs = [e2] self.outputs = [e2]
class OfgSimple(object): class OfgSimple:
def __init__(self): def __init__(self):
x, y, z = tt.scalars("xyz") x, y, z = tt.scalars("xyz")
e = tt.nnet.sigmoid((x + y + z) ** 2) e = tt.nnet.sigmoid((x + y + z) ** 2)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论