提交 dcd43ac9 authored 作者: Frederic's avatar Frederic

Make Join and GpuJoin raise error in make_node instead of run time.

At least, it was an error in Join at run time.
上级 0629b998
......@@ -3410,6 +3410,10 @@ class Join(Op):
bcastable = [False] * len(
as_tensor_variable_args[0].type.broadcastable)
if not python_all([x.ndim == len(bcastable)
for x in as_tensor_variable_args[1:]]):
raise TypeError("Join() can only join tensor with the same number of dimensions.")
inputs = [as_tensor_variable(axis)] + list(as_tensor_variable_args)
if inputs[0].type not in int_types:
raise TypeError('Axis could not be cast to an integer type',
......
......@@ -3317,6 +3317,12 @@ class T_Join_and_Split(unittest.TestCase):
numpy.concatenate([T_shared.get_value(),
T_shared.get_value()]))
def test_mixed_ndim_error(self):
rng = numpy.random.RandomState(seed=utt.fetch_seed())
v = self.shared(rng.rand(4).astype(self.floatX))
m = self.shared(rng.rand(4, 4).astype(self.floatX))
self.assertRaises(TypeError, self.join_op(), 0, v, m)
class test_comparison(unittest.TestCase):
"""Test <, >, <=, >=, == and !=
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论