def test_join_matrixV_negative_axis(self):
"""variable join negative axis"""
v = numpy.array([[.1, .2, .3], [.4, .5, .6]], dtype=self.floatX)
a = self.shared(v)
b = as_tensor_variable(v)
ax = lscalar()
s = join(ax, a, b)
f = inplace_func([ax], [s], mode=self.mode)
topo = f.maker.fgraph.toposort()
assert [True for node in topo
if isinstance(node.op, type(self.join_op))]
want = numpy.array([[.1, .2, .3, .1, .2, .3],
[.4, .5, .6, .4, .5, .6]])
got = f(-1)
assert numpy.allclose(got, want)
want = numpy.array([[.1, .2, .3], [.4, .5, .6],
[.1, .2, .3], [.4, .5, .6]])
got = f(-2)
assert numpy.allclose(got, want)
self.assertRaises(IndexError, f, -3)
评论列表
文章目录