提交 6cf17098 authored 作者: happygds's avatar happygds 提交者: GitHub

add a test for tensor.roll() when axis < 0

上级 b19fcc13
...@@ -3781,6 +3781,15 @@ class T_Join_and_Split(unittest.TestCase): ...@@ -3781,6 +3781,15 @@ class T_Join_and_Split(unittest.TestCase):
want = numpy.roll(a.get_value(borrow=True), -2, 1) want = numpy.roll(a.get_value(borrow=True), -2, 1)
out = theano.function([], b)() out = theano.function([], b)()
assert (out == want).all()
# Test example when axis < 0 - ensure that behavior matches numpy.roll behavior
a = self.shared(numpy.arange(24).reshape((3, 2, 4)).astype(self.floatX))
b = roll(a, get_shift(-2), -2)
want = numpy.roll(a.get_value(borrow=True), -2, -2)
out = theano.function([], b)()
assert (out == want).all() assert (out == want).all()
# Test rolling on axis 0 # Test rolling on axis 0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论