提交 207d58a8 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Enable use of may_share_memory with subclasses of ndarray

上级 e0d6e9c6
......@@ -575,11 +575,11 @@ class TensorType(Type):
@staticmethod
def may_share_memory(a,b):
#when this is called with a an ndarray and b
#a sparce matrix, numpy.may_share_memory fail.
if a.__class__ is b.__class__:
# This is a method of TensorType, so both a and b should be ndarrays
if isinstance(a, numpy.ndarray) and isinstance(b, numpy.ndarray):
return numpy.may_share_memory(a,b)
else: return False
else:
return False
@staticmethod
def values_eq(a, b):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论