提交 7365e01e authored 作者: David Warde-Farley's avatar David Warde-Farley 提交者: Arnaud Bergeron

Things that need to be lists but aren't.

上级 069a9912
......@@ -2291,8 +2291,8 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
inputs = [inputs]
# Wrap them in In or Out instances if needed.
inputs = map(self.wrap_in, inputs)
outputs = map(self.wrap_out, outputs)
inputs, outputs = (list(map(self.wrap_in, inputs)),
list(map(self.wrap_out, outputs)))
_inputs = gof.graph.inputs([o.variable for o in outputs] +
[i.update for i in inputs
if getattr(i, 'update', False)])
......@@ -2320,7 +2320,7 @@ class _Maker(FunctionMaker): # inheritance buys a few helper functions
optimizer(fgraph)
theano.compile.function_module.insert_deepcopy(
fgraph, inputs, outputs + additional_outputs)
fgraph, inputs, list(chain(outputs, additional_outputs)))
finally:
theano.config.compute_test_value = compute_test_value_orig
......
......@@ -87,7 +87,7 @@ class MyOp(Op):
def make_node(self, *inputs):
assert len(inputs) == self.nin
inputs = map(as_variable, inputs)
inputs = list(map(as_variable, inputs))
for input in inputs:
if input.type is not tdouble:
raise Exception("Error 1")
......
......@@ -65,7 +65,7 @@ class MyOp(Op):
def make_node(self, *inputs):
assert len(inputs) == self.nin
inputs = map(as_variable, inputs)
inputs = list(map(as_variable, inputs))
for input in inputs:
if not isinstance(input.type, MyType):
raise Exception("Error 1")
......
......@@ -46,7 +46,7 @@ def MyVariable(thingy):
class MyOp(Op):
def make_node(self, *inputs):
inputs = map(as_variable, inputs)
inputs = list(map(as_variable, inputs))
for input in inputs:
if not isinstance(input.type, MyType):
print(input, input.type, type(input), type(input.type))
......
......@@ -39,7 +39,7 @@ class MyOp(Op):
def make_node(self, *inputs):
assert len(inputs) == self.nin
inputs = map(as_variable, inputs)
inputs = list(map(as_variable, inputs))
for input in inputs:
if input.type is not tdouble:
raise Exception("Error 1")
......
......@@ -57,7 +57,7 @@ class MyType(Type):
class MyOp(Op):
def make_node(self, *inputs):
inputs = map(as_variable, inputs)
inputs = list(map(as_variable, inputs))
for input in inputs:
if not isinstance(input.type, MyType):
raise Exception("Error 1")
......
......@@ -39,7 +39,7 @@ class MyOp(Op):
self.x = x
def make_node(self, *inputs):
inputs = map(as_variable, inputs)
inputs = list(map(as_variable, inputs))
for input in inputs:
if not isinstance(input.type, MyType):
raise Exception("Error 1")
......
......@@ -39,7 +39,7 @@ class MyOp(Op):
def make_node(self, *inputs):
assert len(inputs) == self.nin
inputs = map(as_variable, inputs)
inputs = list(map(as_variable, inputs))
for input in inputs:
if not isinstance(input.type, MyType):
raise Exception("Error 1")
......
......@@ -237,7 +237,7 @@ class test_upgrade_to_float(object):
# at least float32, not float16.
unary_ops_vals = [
(inv, list(range(-127, 0) + range(1, 127))),
(inv, list(range(-127, 0)) + list(range(1, 127))),
(sqrt, list(range(0, 128))),
(log, list(range(1, 128))),
(log2, list(range(1, 128))),
......@@ -262,7 +262,7 @@ class test_upgrade_to_float(object):
(arctanh, [0])]
binary_ops_vals = [
(arctan2, list(range(-127, 128), range(-127, 128)))]
(arctan2, list(range(-127, 128)), list(range(-127, 128)))]
@staticmethod
def _test_unary(unary_op, x_range):
......@@ -306,8 +306,8 @@ class test_upgrade_to_float(object):
def test_true_div(self):
# true_div's upcast policy is not exactly "upgrade_to_float",
# so the test is a little bit different
x_range = range(-127, 128)
y_range = range(-127, 0) + range(1, 127)
x_range = list(range(-127, 128))
y_range = list(range(-127, 0)) + list(range(1, 127))
xi = int8('xi')
yi = int8('yi')
......
......@@ -1706,7 +1706,7 @@ class T_Scan(unittest.TestCase):
# Also validate that the mappings outer_inp_from_outer_out and
# outer_inp_from_inner_inp produce the correct results
scan_node = updates.values()[0].owner
scan_node = list(updates.values())[0].owner
result = scan_node.op.var_mappings['outer_inp_from_outer_out']
expected_result = {0: 3, 1: 5, 2: 4}
......@@ -3662,7 +3662,7 @@ class T_Scan(unittest.TestCase):
n_steps=10,
truncate_gradient=-1,
go_backwards=False)
cost = updates.values()[0]
cost = list(updates.values())[0]
g_sh = tensor.grad(cost, shared_var)
fgrad = theano.function([], g_sh)
assert fgrad() == 1
......
......@@ -846,7 +846,8 @@ _good_broadcast_div_mod_normal_float_no_complex = dict(
uinteger=(randint(2, 3).astype("uint8"),
randint_nonzero(2, 3).astype("uint8")),
int8=[numpy.tile(numpy.arange(-127, 128, dtype='int8'), [254, 1]).T,
numpy.tile(numpy.array(range(-127, 0) + range(1, 128), dtype='int8'),
numpy.tile(numpy.array(list(range(-127, 0)) + list(range(1, 128)),
dtype='int8'),
[255, 1])],
# This empty2 doesn't work for some tests. I don't remember why
#empty2=(numpy.asarray([0]), numpy.asarray([])),
......@@ -933,7 +934,7 @@ TrueDivInplaceTester = makeBroadcastTester(
_good_inv = dict(
normal=[5 * rand_nonzero((2, 3))],
integers=[randint_nonzero(2, 3)],
int8=[numpy.array(range(-127, 0) + range(1, 127), dtype='int8')],
int8=[numpy.array(list(range(-127, 0)) + list(range(1, 127)), dtype='int8')],
complex=[randcomplex_nonzero((2, 3))],
empty=[numpy.asarray([], dtype=config.floatX)])
......
......@@ -388,7 +388,7 @@ class CompressTester(utt.InferShapeTester):
class TestRepeatOp(utt.InferShapeTester):
def _possible_axis(self, ndim):
return [None] + range(ndim) + [-i for i in range(ndim)]
return [None] + list(range(ndim)) + [-i for i in range(ndim)]
def setUp(self):
super(TestRepeatOp, self).setUp()
......
......@@ -33,7 +33,7 @@ class MyOp(Op):
self.x = x
def make_node(self, *inputs):
inputs = map(as_variable, inputs)
inputs = list(map(as_variable, inputs))
for input in inputs:
if not isinstance(input.type, MyType):
raise Exception("Error 1")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论