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

Apply pyupgrade to tests.compile

上级 8caceba6
...@@ -2,7 +2,6 @@ import sys ...@@ -2,7 +2,6 @@ import sys
import numpy as np import numpy as np
import pytest import pytest
from six import reraise
import theano import theano
import theano.tensor import theano.tensor
...@@ -301,7 +300,7 @@ def test_badoptimization_opt_err(): ...@@ -301,7 +300,7 @@ def test_badoptimization_opt_err():
new_e = e.__class__("TTT" + str(e)) new_e = e.__class__("TTT" + str(e))
exc_type, exc_value, exc_trace = sys.exc_info() exc_type, exc_value, exc_trace = sys.exc_info()
exc_value = new_e exc_value = new_e
reraise(e.__class__, exc_value, exc_trace) raise exc_value.with_traceback(exc_trace)
def test_stochasticoptimization(): def test_stochasticoptimization():
......
...@@ -251,7 +251,7 @@ class TestFunction: ...@@ -251,7 +251,7 @@ class TestFunction:
def t(): def t():
f = function( f = function(
[ [
In(a, name=set(["adsf", ()]), value=1.0), In(a, name={"adsf", ()}, value=1.0),
In(x, name=(), value=2.0), In(x, name=(), value=2.0),
In(s, name=tt.scalar(), value=3.0), In(s, name=tt.scalar(), value=3.0),
], ],
...@@ -1091,7 +1091,7 @@ class TestPicklefunction: ...@@ -1091,7 +1091,7 @@ class TestPicklefunction:
assert blah.f1[blah.s] != blah2.f1[blah2.s] assert blah.f1[blah.s] != blah2.f1[blah2.s]
class SomethingToPickle(object): class SomethingToPickle:
def __init__(self): def __init__(self):
a = tt.scalar() # the a is for 'anonymous' (un-named). a = tt.scalar() # the a is for 'anonymous' (un-named).
x, s = tt.scalars("xs") x, s = tt.scalars("xs")
......
...@@ -6,7 +6,7 @@ from theano.compile.sharedvalue import shared ...@@ -6,7 +6,7 @@ from theano.compile.sharedvalue import shared
from theano.tensor.nnet import sigmoid from theano.tensor.nnet import sigmoid
class NNet(object): class NNet:
def __init__( def __init__(
self, self,
input=None, input=None,
...@@ -17,7 +17,7 @@ class NNet(object): ...@@ -17,7 +17,7 @@ class NNet(object):
lr=1e-3, lr=1e-3,
**kw, **kw,
): ):
super(NNet, self).__init__(**kw) super().__init__(**kw)
if input is None: if input is None:
input = tensor.dvector("input") input = tensor.dvector("input")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论