提交 e5a4d61d authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Fix intermittent test when indices are repeated.

上级 7bb1b48a
...@@ -1135,7 +1135,10 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin): ...@@ -1135,7 +1135,10 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
m2_ref = m_val.copy() m2_ref = m_val.copy()
m1_val, m2_val = f(m_val, i_val) m1_val, m2_val = f(m_val, i_val)
for idx in i_val: # We have to explicitly loop over all individual indices,
# not as a list or array, numpy only increments the indexed
# elements once even if the indices are repeated.
for idx in i_val.ravel():
m1_ref[:, idx] = 0 m1_ref[:, idx] = 0
m2_ref[:, idx] += 1 m2_ref[:, idx] += 1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论