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