提交 2ec93e3b authored 作者: Frederic's avatar Frederic

[CRASH] Fix the hashing of Shape_i with ndarray index.

上级 79f84e0f
......@@ -317,6 +317,12 @@ class Shape_i(gof.Op):
__props__ = ("i",)
def __init__(self, i):
# As i will be used in the hash and that ndarray are not hashable,
# we need to convert it to an int as it is hashable.
if isinstance(i, numpy.ndarray):
assert "int" in str(i.dtype)
assert i == int(i)
i = int(i)
self.i = i
def __str__(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论