提交 a35e466a authored 作者: Frederic Bastien's avatar Frederic Bastien

TensorType.may_share_memory don't crash when both type don't have the same type.

上级 271ed2dd
......@@ -531,7 +531,12 @@ class TensorType(Type):
@staticmethod
def may_share_memory(a,b):
return numpy.may_share_memory(a,b)
import pdb;pdb.set_trace()
#when this is called with a an ndarray and b
#a sparce matrix, numpy.may_share_memory fail.
if a.__class__ is b.__class__:
return numpy.may_share_memory(a,b)
else: return False
@staticmethod
def values_eq(a, b):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论