提交 709f745c authored 作者: Ricardo Vieira's avatar Ricardo Vieira 提交者: Jesse Grabowski

Fix bug in handling of row/column matrices in GEMV c_code

Bug was caused by reusing the adjusted strides in the logic to decide whether the call to GEMV should be transposed or not. Particularly the +1 in the strides variable was causing the error branch (no double-strides) to be reached wrongly. The +1 was supposedly there for the case of matrix with length 0, but that triggers a branch where the adjusted strides are never used. This bug was introduced in afe934b2
上级 86cc3b87
差异被折叠。
......@@ -2226,8 +2226,10 @@ class TestBlasStrides:
a.set_value(a_dev.copy()[::a_step], borrow=True)
b.set_value(b_dev.copy()[::b_step1, ::b_step2], borrow=True)
# Copy as C so that it becomes F after the transpose in the graph
b_t.set_value(
np.transpose(b_dev.copy())[::b_step2, ::b_step1], borrow=True
np.transpose(b_dev).copy(order="C")[::b_step2, ::b_step1],
borrow=True,
)
c.set_value(c_dev.copy()[::c_step], borrow=True)
......@@ -2244,6 +2246,7 @@ class TestBlasStrides:
self.cmp_gemv(3, (3, 5), 5, rng)
self.cmp_gemv(1, (1, 5), 5, rng)
self.cmp_gemv(3, (3, 1), 1, rng)
self.cmp_gemv(1, (1, 1), 1, rng)
self.cmp_gemv(0, (0, 5), 5, rng)
self.cmp_gemv(3, (3, 0), 0, rng)
self.cmp_gemv(0, (0, 1), 1, rng)
......@@ -2301,6 +2304,7 @@ class TestBlasStrides:
self.cmp_ger((3, 5), 3, 5, rng)
self.cmp_ger((1, 5), 1, 5, rng)
self.cmp_ger((3, 1), 3, 1, rng)
self.cmp_ger((1, 1), 1, 1, rng)
self.cmp_ger((0, 5), 0, 5, rng)
self.cmp_ger((3, 0), 3, 0, rng)
self.cmp_ger((0, 1), 0, 1, rng)
......
......@@ -243,6 +243,7 @@ class TestCGemv(OptimizationTestMixin):
self.t_gemv1((0, 2))
self.t_gemv1((3, 1))
self.t_gemv1((3, 0))
self.t_gemv1((1, 1))
self.t_gemv1((1, 0))
self.t_gemv1((0, 1))
self.t_gemv1((0, 0))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论